workflow script to check if requestor is a manager of any group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2024 04:44 AM - edited 01-23-2024 04:46 AM
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());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2024 05:49 AM
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);
}