Need assistance with List Collector Workflow Approval

alhicks
Tera Guru

I have this script (found on community) and it's working.  It pulls the list of approvers and adds to the RITM approval record.  Some of the items in list collector variable (teradata_options) have multiple approvers and we only need 1 approval for each item selected.   If we have multiple options selected in the list collector, of course we have multiple groups of approvers.   If we use Approval-User in the workflow, then the approval isn't waiting on everyone from each group/item approval.  If we use Approval-Group, it's skipping the approval.

ADDITIONAL APPROVERS SCRIPT

answer = myScript();

function myScript() {

var app = current.variables.teradata_options.toString();

var list = app.split(',');

var appList = [];

for (var i = 0; i < list.length; i++) {

var ci = new GlideRecord('u_key_word');

if (ci.get(list[i])) {

appList.push(ci.getValue('u_approvers'.toString()));

//gs.log("andrea " + applist + ci.u_approvers);
//appList.push(ci.getValue('u_approvers'));


}

}

return appList;
}

 

APPROVAL - USER in Workflow

 

find_real_file.png

 

 

APPROVAL - GROUP  in Workflow

find_real_file.png

 

Options on Catalog Item and the approvers in group 1 and 2, with manager approval.  Someone from group 1 needed to approve.

find_real_file.png

1 ACCEPTED SOLUTION

From the teradata_options can you identify which ones are #1 approvers, #2 approver, and manager? If yes, you can create multiple Approval - users.

The Approval User workflow activity is looking for users, but the Approval Group is looking for group names. Since you're sending Users, Approval Group isn't working. Can you send groups?

View solution in original post

3 REPLIES 3

Michael Fry1
Kilo Patron

How about introducing an Array and then use Unique to filter out the duplicates. Obviously do this before pushing to appList. https://docs.servicenow.com/bundle/newyork-application-development/page/app-store/dev_portal/API_ref...

Once you have unique values, change the Approval - User workflow activity, Wait for - All approvals.

Thank you for the reply Michael,  I may not have explained it correctly.  We actually don't have duplicates.  Like in this example, we have 3 people that receive the approval for one of the options.  Only 1 from that group needs to approve.  Then we need the approval from Roger, he's the approver for a different option that was selected.

 

find_real_file.png

From the teradata_options can you identify which ones are #1 approvers, #2 approver, and manager? If yes, you can create multiple Approval - users.

The Approval User workflow activity is looking for users, but the Approval Group is looking for group names. Since you're sending Users, Approval Group isn't working. Can you send groups?