- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-18-2018 11:43 AM
Hi guys, would really appreciate it if anyone can help with this. We are hoping to update our change request workflows so that when 'Technical approvers' are added everyone in the Service.Approval group is added and all are required. Easy right!
However we'd also like it so that members of any child/sub groups of this approval group are added also - however only one approval from each of these child groups would be required.
Finally, if a particular change field, 'Business impact' has a value we would also like to include other specific customer service related approval groups. The approval group would be dependent on the 'Impacted region(s)' (a list field) of the change so for example approval group 'CS-USA', if 'USA' is selected or e.g. 'CS-USA' AND 'CS-Canada' if 'Impacted region(s)' values are USA and Canada (from these groups only one approval is required).
So big question, is it possible to somehow tie this up in one approval group activity and if so how?! Thank-you guys.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-20-2018 06:29 AM
Thanks for confirming. The following script should work. Click the advanced checkbox in the group approval activity and paste this in. It first sets up the answer array and then validates there is a business service set on the change and that the business service also has an approval group defined before calling the function to gather the child groups.
Please mark this post or any as helpful or the correct answer to your question so others viewing can benefit.
var answer = [];
// Validate there is a business service and approval group
if (current.business_service && current.business_service.change_control) {
recursChildGroups(current.business_service.change_control);
}
function recursChildGroups(group){
//Make sure that we have a valid group ID
if(group){
if(group.toString().length == 0){
return null;
}
//Query for the active child groups of this group
var rec = new GlideRecord('sys_user_group');
rec.addQuery('parent', group);
rec.addQuery('active', true);
rec.query();
while(rec.next()){
//If the group has already been added then do not add again
if(answer.toString().indexOf(rec.sys_id.toString()) > -1){
continue;
}
//Add the group to the final array
answer.push(rec.sys_id.toString());
//Find the child groups of this group
recursChildGroups(rec.sys_id.toString());
}
}
return null;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-20-2018 09:11 AM
Awesome, happy to help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-25-2018 03:18 AM
Hi Michael, if you get a chance could you please look at this latest post for me:
https://community.servicenow.com/community?id=community_question&sys_id=9c5295b4db23d7c0f7fca851ca961976
Thanks as always.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-02-2018 07:59 AM
Hi Michael, I'm having some difficulty with approval records and wondered if you might have any ideas. After a rejection, when it resets we're finding existing approval records that were showing as 'No longer required' (as expected, as part of another user's rejection) are resetting to 'Requested' - as well as new approval records being added for those approvers. Not sure if it's to do with the 'Disassociate approval records' stage needing amending as we've customized the technical approvals stage? Many thanks.
New post here for this query:
https://community.servicenow.com/community?id=community_question&sys_id=994f1033db63d300fff8a345ca96198c
Thanks.