In The Name of Allaah, The Most Merciful, The Bestower of Mercy.
Imaam Ibnul Qayyim [may Allaah have mercy upon him] said: “The servant should hand over affairs to the One (Allaah) who knows – (perfectly without anything hidden from Him and free is He from all imperfections) – the end result of affairs. He should be pleased with what Allaah chooses and decrees because of the good end result one hopes for- neither make suggestions to Allaah nor give precedence to one’s choice over Allaah’s choice. One should not choose anything over what Allaah chooses; rather one asks Allaah to choose the best and make him (or her) pleased with what has been chosen, because there is nothing more beneficial than this. If one is pleased with Allaah’s choice, then what has been decreed will occur, whilst one is deserving of commendation”. [An Excerpt from Al-Fawaa’id. page 204. slightly paraphrased]
It is stated as part of a supplication: [وَأَسْأَلُكَ الرِّضِا بَعْدَ الْقَضَاءِ – And I ask You (to make me pleased) after (Your) decree]. This is one of the supplications performed after the Tashahud and before the Tasleem. Here is the complete supplication as follows:
اللَّهُمَّ بِعِلْمِكَ الْغَيْبَ وَقُدْرَتِكَ عَلَى الْخَلْقِ أَحْيِنِي مَا عَلِمْتَ الْحَيَاةَ خَيْراً لِي وَتَوَفَّنِي إِذَا عَلِمْتَ الْوَفَاةَ خَيْراً لِي، اللَّهُمَّ إِنِّي أَسْأَلُكَ خَشْيَتَكَ فِي الْغَيْبِ وَالشَّهَادَةِ، وَأَسْأَلُكَ كَلِمَةَ الْحَقِّ فِي الرِّضَا وَالْغَضَبِ، وَأَسْأَلُكَ الْقَصْدَ فِي الْغِنَى وَالْفَقْرِ، وَأَسْأَلُكَ نَعِيماً لَا يَنْفَذُ، وَأَسْأَلُكَ قُرَّةَ عَيْنٍ لَا تَنْقَطِعُ، وَأَسْأَلُكَ الرِّضِا بَعْدَ الْقَضَاءِ، وَأَسْأَلُكَ بَرْدَ الْعَيْشِ بَعْدَ الْمَوْتِ، وَأَسْأَلُكَ لَذَّةَ النَّظَرِ إِلَى وَجْهِكَ وَالشَّوْقَ إِلَى لِقَائِكَ فِي غَيْرِ ضَرَّاءَ مُضِرَّةٍ وَلَا فِتْنَةٍ مُضِلَّةٍ، اللَّهُمَّ زَيِّنَّا بِزِينَةِ الْإِيمَانِ
وَاجْعَلْنَا هُدَاةً مُهْتَدِينَ
O Allah! By Your Knowledge of the unseen and by Your Power over creation, let me live if life is good for me, and let me die if death is good for me; O Allah! I ask You to grant me (the blessing of having) fear of You in private and public; And I ask you (to make me utter) a statement of truth in times of contentment and anger; And I ask You for moderation when in a state of wealth and poverty; And I ask you for blessings that never ceases; And I ask You for the coolness of my eye that never ends; And I ask You (to make me pleased) after (Your) decree; Aand I ask You for a life of (ease, comfort, tranquility etc) after death; I ask You for the delight of looking at Your Face (i.e. in the Hereafter) and yearning to meet You without any harm and misleading trials (coming upon me); O Allah! Adorn us with the adornment of Eemaan, and make us (from those who are) guided and guiding (others). [Silsilah As-Saheehah. Number 1301]