After an impersonation using session.onlineImpersonate(), can a subsequently triggered business rule identify the original user?

Courtney Richar
Tera Contributor

We have a script that does a session.onlineImpersonate().

It then inserts a record, which triggers a business rule.

Within the business rule, can the original user be identified via GlideSession or other mechanism?

3 REPLIES 3

Prateek kumar
Mega Sage

There is an impersonation log record created for every Impersonation activity. See if this helps.

https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/administer/users_and_groups/conce...

and in the below thread using a script action there is a solution proposed to capture the user activity.

https://community.servicenow.com/community?id=community_question&sys_id=40b449e0dba56700fb115583ca96...


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

Thanks Prateek.

What I'm looking for is a JavaScript function that would return the old (prior to impersonation) user.

Do any of the Glide scripts provide something like that?

 

I am afraid there is no direct method, may be instead you can utilize gs.getSession() object to add current user prior to impersonation to the session and retrieve it as shown here.

 

putClientData() and getClientData()