Workflow Approval based on List Collector Variable

Sandy7
Tera Expert

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

find_real_file.png

 

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