- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2021 01:08 PM
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
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2021 01:38 PM
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());

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2021 01:38 PM
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());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2021 11:18 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2021 11:33 PM
Hi Brian,
This code actually worked.
answer = [];
answer.push(current.variables.name_of_the_group.manager.toString());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2021 11:34 PM
Thank You
Appreciate all your help.