Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How do you get the recent list of Impersonations attempts for a user?

heather_mcmanig
Kilo Contributor

I'm recreating the impersonate modal in a portal page menu and have it nearly finished. I still need the list of recent impersonations that the user has recently attempted. Is there any way to access this data?

Thanks!

9 REPLIES 9

I need the list because I am recreating the modal for Impersonate User in a portal page menu. This includes a quick reference list of people that user has impersonated, I believe it's a max of 5 or 6.


The only way I know to look for the details is through event log as I've mentioned before. You can work on michael.ritchie suggestion and run a script action to log this data into a custom table.



-Darshak


Heather, sorry I misunderstood your intent of needing this list. The list of recent impersonations is stored in a user preference record named recent.impersonations. You can use the following script to get the list for the current logged in user:


gs.getUser().getPreference("recent.impersonations")



This should output a string separated by commas.


Thank you that's exactly what I need!


Awesome happy to help. Please mark any post helpful or the answer to your question so other reading this can benefit.