Return multiple values from Action in Flow Designer

Andrew Albury-D
Mega Guru

Hi all,

I have made a Script Action in flow designer to find an approver based on the "Manager" field from the submitter of a request, however if there is no manager it should return two other users who are fallback approvers for our whole business. 

What data type should the Output be, and how do I return multiple values to it? I've tried "Reference" but it only accepts a single sysid, i've tried "Records" but I couldn't see how to enter the data.

Thanks a lot,

Andrew

1 ACCEPTED SOLUTION

rahulpandey
Kilo Sage

Hi,

You can create a JSON object to return multiple values like below

var obj = {};

obj.approver = gr.manager.toString();

obj.approver = gr.user1.toString();

obj.approver = gr.user2.toString();

 

The out put field can be data type 'list', where multiple values can be selected. You can refer watchlist column on incident table for example.

 

 

View solution in original post

4 REPLIES 4

Arnoud Kooi
ServiceNow Employee
ServiceNow Employee

Try DocumentID, you can just return a single sys_id, or a list comma separated.

rahulpandey
Kilo Sage

Hi,

You can create a JSON object to return multiple values like below

var obj = {};

obj.approver = gr.manager.toString();

obj.approver = gr.user1.toString();

obj.approver = gr.user2.toString();

 

The out put field can be data type 'list', where multiple values can be selected. You can refer watchlist column on incident table for example.

 

 

Thanks Rahul, I believe this is the correct answer. I also note that with list you can return a string containing multiple sys_ids, comma separated

Hi 

I'm making an API call within Flow Designer to get a list of policy terms like below.  But I only need the two most recent terms.  How would I limit the returns?  If that is not an option, any suggestions on how I could limit the list?

 

latroyamitchell_0-1699949014951.png