عَنْ عَبْدِ اللَّهِ بْنِ عَمْرٍو رَضِيَ اللَّهُ عَنْهُمَا عَنِ النَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ قَالَ مَا أَحَدٌ مِنَ النَّاسِ يُصَابُ بِبَلَاءٍ فِي جَسَدِهِ إِلَّا أَمَرَ اللَّهُ عَزَّ وَجَلَّ الْمَلَائِكَةَ الَّذِينَ يَحْفَظُونَهُ فَقَالَ اكْتُبُوا لِعَبْدِي كُلَّ يَوْمٍ وَلَيْلَةٍ مَا كَانَ يَعْمَلُ مِنْ خَيْرٍ مَا كَانَ فِي وِثَاقِي
It is narrated from Sayyiduna Abdullah bin Amr (may Allah be pleased with them both) that the Noble Prophet (peace and blessings be upon him) said: When a person is afflicted with a physical hardship, Allah Almighty says to the angels who record (good deeds): As long as My servant is in the confinement of My (trial), you should continue to record his usual good deeds of day and night.