workflow script to check if requestor is a manager of any group

Siddharth4
Tera Contributor

Hi All,

 

In a workflow script, I want to trigger an event which will send the notification to the requestor's manager only when the requestor is a owner/manager of any group. I was using the script below, but I am unable to add condition that if requestor is a owner of any group then only the event get triggered. In the below script we added the add the manager name in a event query parameter.

Please help me suggesting or providing the script.

Thanks 

 

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());

 

1 REPLY 1

Brad Bowman
Kilo Patron
Kilo Patron

You'll want to do a GlideRecord on the group table to check the manager, or whichever field for the requestor:

var req = current.request.requested_for.toString();
var grp = new GlideRecord('sys_user_group');
grp.addQuery('manager', req);
grp.query();
if (grp.next()) {
    gs.eventQueue('appservice.inactiveuser.notification',null,current.request.requested_for.manager.toString(),req);
}