- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 12-09-2019 09:16 AM
Hello everybody,
during tests, it is often necessary to impersonate users who are in the ticket assignment group.
To speed up this operation, I created an UI Action, which allows you to impersonate a (random) user of the assignment group.
A message indicates which user was impersonated
This is the UI Action
Name: Impersonate user in group
Table: Catalog Task (select the desired table)
Condition:
current.assignment_group && ( gs.getUser().hasRole("impersonator") || gs.getImpersonatingUserName() != "" )
Script:
// Retrieve user in group
var gr = new GlideRecord("sys_user_grmember");
gr.addQuery("group",current.assignment_group);
gr.addQuery("user.active",true);
gr.addQuery("user.sys_id","!=",gs.getUserID()); // Me
gr.setLimit(1);
gr.query();
// Impersonate
if(gr.next()){
session.onlineImpersonate(gr.user);
gs.addInfoMessage("Impersonated: " + gr.user.name);
action.setRedirectURL(current);
} else {
gs.addInfoMessage("No user impersonated! Please check the members of the group");
}
I hope it's useful!
Corrections and comments are welcome 🙂
Daniele
- 1,469 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Good idea!
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi, I like it. Only I am missing a button/link to end impersonation.
A person is impersonated, but I still see the admin account in the top right corner. So it could be confusing.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
This is a good idea. Ultimately I would prefer the Impersonate User be expanded to include using criteria like group and roles.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
its a nice implementation. But how to end this impersonation ? Have you also worked on any solution for this ?