Workflow script for adding user to group via manager approval of RITM

Sourav15
Tera Contributor

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.

1 REPLY 1

johnfeist
Mega Sage
Mega Sage

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.

johnfeist_0-1717784507174.png

 

 

 

 

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster