How to get approval within Flow from dynamic approvers (within multiple records)

Ahmet Damli
Tera Contributor

Hi,

i want to create a subflow (with flow Designer) for approval of Service Requests. The approvers need to be looked up in another table (in this example from submitters of change models). I can lookup for the records. But afterwards i can not access the submitter-Field from this records to get them as approvers for the service request. How could i solve this?Its it not possible to get the submitters from the change model records.

8 REPLIES 8

Hi Jacqui, 

i struggle with replace "my object". How can i access each record of the "lookup records" action in the script? 

e.g.:
fd_data._1__look_up_records[0].u_change_manager.sys_id 
fd_data._1__look_up_records.records[0].u_change_manager.sys_id;
do not work, to access the first record.
 

Jacqui
ServiceNow Employee
ServiceNow Employee

In the end, the solution I provided works in Orlando but not in New York. There is a known issue with fd_data lookup records. I used this workaround to replace the lookup records to get the data and then manipulate it to use it for multiple approvals.

 

var rec = new GlideRecord('table_with_records');
rec.addQuery('active','true');
rec.query();
var sys_ids = [];

while(rec.next()) {
    sys_ids.push(rec.sys_id); 
}

return 'ApprovesAnyU[' + sys_ids.join(',') + ']';

 

It is associated with PRB1361893 that was solved in Orlando, so the code I provided in the other reply should work after an upgrade. This code on this reply will work in New York.

Hi @Jacqui , thanks for providing this.

Just wanted to add a bit extra as we discovered when implementing this strategy our flow was not moving onto the next step if any user rejects. In order to ensure rejection is functioning correctly we used the following return code:

return 'ApprovesAnyU[' + sys_ids + ']OrRejectsAnyU[' + sys_ids + ']';

Sumit35
Tera Contributor

How can we access the catalog item variable value in above script ?