How to show alert message when we impersonate to other user and try to update any record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2022 05:33 AM
We usually impersonate to other user to check any issue reported by that user. Later we forget that we are on impersonation and update other records unrelated to this user which will update the impersonated users name in the time stamps.
To avoid that , can we show an alert message whenever we try to update any record with impersonation. I see from docs that we can know the impersonated user and whether we are on impersonation with OOB functions. But where to write this script, for it to apply for all updates in the instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2022 06:26 AM
Are you talking about in production or sub-prod?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2022 10:44 AM
Hello Mike, I am talking about Production
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2022 06:54 AM - edited ‎10-31-2022 07:13 AM
Hi @Pallavi K1 ,
Mostly this happens on any task record. So, I would so you how you can do it on any task record be it incident/prob/change/req:
1. Write a Display BR on task table with below script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
g_scratchpad.isImpersonated = GlideImpersonate().isImpersonating();
})(current, previous);
2. Write a client script on task table with below code:
function onSubmit() {
//Type appropriate comment here, and begin script below
if(g_form.modified && g_scratchpad.isImpersonated){
alert("You are imporsonated with other user's account");
return false;
}
}
Make sure inherited check box is check on your client script:
Now when you try to make any change it will pop up the alert and won't save anything
I Hope this helps.
Please mark this helpful if this helps and mark as correct if this solves your issue.
Regards,
Kamlesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2022 12:49 AM
Hi @Pallavi K1 ,
Could you please update if your query is resolved? If yes, could you please help us close this thread by Accepting the appropriate response as solution so that it could help others with similar issue.
Regards,
Kamlesh