Script to check if requestor is a manager of any group or not
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2024 05:59 AM
Hi All,
In the workflow script, my goal is to initiate an event that sends a notification to the requestor's manager exclusively when the requestor holds the role of owner or manager within any group. Although I've been working with the script below, I'm encountering challenges in incorporating a condition that ensures the event is triggered only if the requestor is an owner/Manager of any group. In this script, we've included the manager's name in an event query parameter. I would appreciate your assistance in suggesting or providing a revised script that addresses this condition
var req = current.request.requested_for.toString();
var requestor_manager = current.request.requested_for.manager.toString();
gs.eventQueue('appservice.inactiveuser.notification',null,current.request.requested_for.manager.toString(),current.request.requested_for.toString());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2024 06:29 AM
Hi @Siddharth4, Can you try the below script?
var req = current.request.requested_for.toString();
var requestor_manager = current.request.requested_for.manager.toString();
var isManager = false;
var grGroup = new GlideRecord('sys_user_group');
grGroup.addQuery('manager', req);
grGroup.query();
while (grGroup.next()) {
isManager = true;
break;
}
if (isManager) {
gs.eventQueue('appservice.inactiveuser.notification', null, requestor_manager, req);
}
Regards
Sunil