Mishkat al-Masabih 1736
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.
وَعَن أبي مُوسَى اشعري قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: 
" إِذَا مَاتَ وَلَدُ الْعَبْدِ قَالَ اللَّهُ تَعَالَى لِمَلَائِكَتِهِ: قَبَضْتُمْ وَلَدَ عَبْدِي؟ فَيَقُولُونَ: نَعَمْ. فَيَقُولُ: قَبَضْتُمْ ثَمَرَةَ فُؤَادِهِ؟ فَيَقُولُونَ: نَعَمْ. فَيَقُولُ: مَاذَا قَالَ عَبْدِي؟ فَيَقُولُونَ: حَمِدَكَ وَاسْتَرْجَعَ. فَيَقُولُ اللَّهُ: ابْنُوا لِعَبْدِي بَيْتًا فِي الْجَنَّةِ وَسَمُّوهُ بَيت الْحَمد ". رَوَاهُ أَحْمد وَالتِّرْمِذِيّ