Abu Musa al-Ash'ari reported God's messenger as saying:
When a man's child dies God most high asks His angels whether they have taken His servant's child and they reply that they have. He then asks whether they have taken the fruit of his heart (This is said by some to mean either children or grandchildren, and a basis for that meaning is found in Qur’an, ii, 155, where the plural ath-thamarat is interpreted that way), and when they reply that they have, He asks what His servant said. On their replying that he praised God and said, “We belong to God and to Him do we return,” God says, “Build a house in paradise for my servant and call it the house of praise.” Ahmad and Tirmidhi transmitted it.
Reported by At-Tirmidhi (No. 1021). Cited in Mishkat al-Masabih (No. 1736).
وعن أبي موسي رضي الله عنه أن رسول الله صلى الله عليه وسلم قال: إذا مات ولد العبد، قال الله تعالي لملائكته: قبضتم ولد عبدي، فيقولون: نعم، فيقول: قبضتم ثمرة فؤاده، فيقولون: نعم. فيقول: ماذا قال عبدي…
"إذا مات ولد العبد قال الله تعالى لملائكته: قبضتم ولد عبدي؟ فَيقولون : نَعَمْ ، فيقول : قَبَضْتُمْ ثَمَرَةَ فُؤادِهِ ؟ فيقولون : نَعَمْ ، فيقول : فماذا قال عبدي؟ فيقولون: حمدك واسترجع، فيقول الله تعالى: ابنوا…