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 08:49 AM
Can you try this
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('u_override_group_setting', '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 08:59 AM
Hi, thanks for the response.
I tried that and it's automatically approving and moving to the next step.
Am I missing something at the beginning since this is a list collector variable..do I somehow need to call that out and set that variable to a string?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2019 09:29 AM
What is the field type of u_override_group_setting
Also can you place a log statement and capture what value is returning for group variable
gs.log('Group: ' + group)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2019 10:14 AM
Hi, that field type is a String. I will add the log statement as well.
Thanks