- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2017 04:22 PM
Hi,
We have a group approval for Change Requests, this approval goes to the assignment group members for approval.
However what I would like to do is only for the approval to go to those members within the assignment group who have the role called "Change Approver" which I have created, I know I could create separate groups but I wish to avoid doing so.
Has anyone ever used such a script to do this and is it possible?
Any help appreciated.
Cheers.
Nabeel
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2017 02:20 PM
Hi Nabeel,
This is what i have tested and it works fine for me, are you having the required group assigned before workflow starts. I have just tested with this setup and it's working. I would have one 'Wait for Condition' to make sure assignment group is there before sending to approval, like below.
Please make sure you pass the correct sys_id of your role.
Result:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2017 05:23 PM
Hi Nabeel,
In advance script, you can query the group members from group id and then for each member check if he has that role or not and push it in answer array.
Thanks.
PS: Hit like, Helpful, Correct and Endorse, if it answers your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2017 05:28 PM
Thanks Nisha, do you know roughly what the script would be? I'm still new to java script and still learning unfortunately.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2017 06:15 PM
You should be having script like that. Please modify accordingly and see if it helps.
var answer = [];
var groupMemberships = new GlideRecord('sys_user_grmember');
groupMemberships.addQuery('group', <group sys_id>);
groupMemberships.query();
while(groupMemberships.next()){
if (groupMemberships.getValue('user').hasRole('change_approver')){
answer.push(user.sys_id);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2017 06:26 PM
Thank you so much Shishir!!
Can I ask the part with "<group sys_id>" I want this script to be dynamic for every group so does this script need the sys id of a specific group?