Add Group Manager/Owner Approval in Workflow before adding user to that group.

rachelturkariga
Giga Contributor

Hi Team,

I have a catalog Item xxxx- with  Variables- Name, Location, User to be added to the group - Reference, Name of the Group- Reference.

Requirement is based data filled in User to be added to the group and Name of the Group , this user should be added to group. - Which I am able to do with the run  script.

var gr = new GlideRecord('sys_user_grmember');

gr.user = current.variables.user_to_be_added_to_the_group;

gr.group = current.variables.name_of_the_group;

gr.insert();

But user is getting added automatically  without any approval - Group Manager/Owner Approval is must before user being added to the group. Only after the Group managers approval user should be added .

Any suggestion/Help.

Regards,

Rachel

1 ACCEPTED SOLUTION

Brian Lancaster
Tera Sage

If you are utilizing the manager field on the group you can just add an approval to your workflow using the advanced script checkbox with the following code.  This is assuming you are using workflow and not flow.  I'm not sure how to do this in flow but I'm guessing the coding would be similar.

answer = [];
answer.push(current.variables.name_of_the_group.manager.toString());

View solution in original post

4 REPLIES 4

Brian Lancaster
Tera Sage

If you are utilizing the manager field on the group you can just add an approval to your workflow using the advanced script checkbox with the following code.  This is assuming you are using workflow and not flow.  I'm not sure how to do this in flow but I'm guessing the coding would be similar.

answer = [];
answer.push(current.variables.name_of_the_group.manager.toString());

rachelturkariga
Giga Contributor

Hi Brian, 

 

Thank You for the reply.

I have added this code. 

answer = [];
answer.push(current.variables.group.manager.toString());

 

But this still skips the approval and adds user to the group.

 

Regards,

Rachel

rachelturkariga
Giga Contributor

Hi Brian,

 

This code actually worked.

 

answer = [];
answer.push(current.variables.name_of_the_group.manager.toString());

Thank You 

Appreciate all your help.