When the son of Adam dies and his soul departs and he is placed in his graver. The two angels who are charged with questioning come to him and ask him what he used to believe in in this world, who was his Lord, what was his religion and who was his Prophet.
https://alhudathequranclub.wordpress.com/2015/12/12/chapter-4-three-fundamental-principles/