Workflow script for adding user to group via manager approval of RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2024 12:33 AM
Hello team,
I am trying to create a catalog item where user will be able to raise the request for being added to the groups and the approval will trigger to the manager of the selected group. Once manager approves the RITM, the user will automatically get added to the group.
The condition in here is, if the manager of the requested group is raising the request, he/she will not receive the approval and the user will automatically get added to the group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2024 11:23 AM
Hi Sourav15,
The process you need to follow is:
Either have a script at the start that does whatever lookups are necessary and put the results on the scratchpad. Then you can access them via workflow.scratchpad.<name>. Otherwise in a script block you would have something like this:
answer = ifScript();
ifScript function() {
var theGroups = new GlideRecord("sys_user_group");
if (theGroups.get("manager", current.variables.opened_by.toString()) {
return true;
}
return false;
}
From there, you can have the false result go to the request approval task and the true go to the step after approvals. Here's your basic shell.
:{)
Helpful and Correct tags are appreciated and help others to find information faster