Workflow Approval based on List Collector Variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2019 08:41 AM
Hi Everyone -
I have a Service Request w/ Workflow tied to it and need to do the following:
1 - I have a variable that is a list collector. I pasted a screenshot of the associated table from where the list collector pulls the data:
The Override Group Setting is the value(s) selected on the Service Request, and the Functional Approval Group is the associated group that needs to approve if that particular override group setting is selected
2- I am not sure how to set this up ... has anyone been able to make this work successfully?
I know I need to set up a Group Approval with Advanced checked, but I am unsure of the syntax to use within that activity. I had the following script below I was testing with but that does not seem to work.. it is automatically approving ..
// Set the variable 'answer' to a comma-separated list of group ids or an array of group ids to add as approvers.
//
// For example:
var answer = [];
// answer.push('id1');
// answer.push('id2');
var group = current.variables.override_settings; //this is the variable name
var getGroupValue = new GlideRecord('u_override_settings'); //this is the table name
getGroupValue.addEncodedQuery('u_override_group_setting'='+group); //this is the column on the table that is the group setting selected
getGroupValue.query();
if(getGroupValue.next())
answer.push(getGroupValue.u_functional_approver_group.toString()); // this is the asscociated approver group

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2019 10:31 AM
What values does u_override_group_setting stores? is it name of group?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2019 10:38 AM
HI, no that is not the name of the group, it is the Override Group Setting (so the column on the very left in the screenshot).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2019 10:47 AM
Can you try this
var answer = [];
var group = current.variables.override_settings; //this is the variable name
var getGroupValue = new GlideRecord('u_override_settings'); //this is the table name
getGroupValue.addQuery('sys_id', 'IN',group); //this is the column on the table that is the group setting selected
getGroupValue.query();
while(getGroupValue.next()){
answer.push(getGroupValue.u_functional_approver_group.toString()); // this is the asscociated approver group
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2019 11:16 AM
Hello,
So I tried that and on the Group Approval action(This is where I put the script), it automatically approves it and advances the workflow. I would expect it to create an approval for that group.
The log returns this:
Group: ffd3e6194fbbab40acfcecee0210c754 which is the sys id for the Override Setting selected.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2019 11:25 AM
Is u_functional_approver_group a reference field pointing to group or is it a string field saving the group name?