Set multiple user approvals based on List collector variable with non-user values

Abilash Kankip1
Tera Contributor

I've a spreadsheet with more than 100 folder names as one column and the other column contains approvers (different approver for every 1 or more folders ). I've built a table to store those folder names as String field and a reference field referencing user table for approvers. And in the catalog, I added a list collector variable referencing this folder table.

 

How to set Approver User activity based on the folders selected on the catalog? And should wait for all the approvals to open a task for fulfillment with only the approved folder access to fulfill.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Abilash Kankip1 

if workflow then use this script

Also ensure it waits for Everyone to approve -> select this option

AnkurBawiskar_0-1743405137627.png

 

answer = [];
var selectedFolders = current.variables.u_sc_folder_access.toString();
var gr = new GlideRecord('u_folder_access');
gr.addQuery('sys_id', 'IN', selectedFolders);
gr.query();
while (gr.next()) {
    var approverSysId = gr.getValue('u_folder_access_approver');
    answer.push(approverSysId);
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

13 REPLIES 13

Ankur Bawiskar
Tera Patron
Tera Patron

@Abilash Kankip1 

if workflow then use this script

Also ensure it waits for Everyone to approve -> select this option

AnkurBawiskar_0-1743405137627.png

 

answer = [];
var selectedFolders = current.variables.u_sc_folder_access.toString();
var gr = new GlideRecord('u_folder_access');
gr.addQuery('sys_id', 'IN', selectedFolders);
gr.query();
while (gr.next()) {
    var approverSysId = gr.getValue('u_folder_access_approver');
    answer.push(approverSysId);
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi @Ankur Bawiskar ,

This script is working good. I've another challenge here. Once approved, I need to do a condition check to open one or two SCTASKS based on the list collector values selected. If list collector values selected starts with only AA, then only one SCTASK, if it starts with other than AA, then also only one SCTASK but to different assignment group. When it starts with AA && other like BB, two SCTASKs should open. Also I need to show only those values under the variables section in respective SCTASK.

@Abilash Kankip1 

Glad to know that my script worked.

I believe I have answered your original question.
Please mark my response as correct and close the thread.

The discussion can still continue on the answered thread.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Abilash Kankip1 

you can use Lookup Record on the table being referred by list collector

Then use IF logic to check if the value starts with AA or BB

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

I am using the workflow since flow designer won't fulfill few of the requirements. how to do this in the standard workflow?

Also the Approver user activity is not moving forward if one of the approver rejected for a specific folder access (bcoz of Everyone to approve wait). I would like to have the task still opened with only the approved ones.