Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Parm2 won't populate my flow variable if it contains a comma separated list

neil_b
Tera Guru

I have a workflow where I create a comma separated list and assign a flow variable the list as it is a String as it is converted from an array.

I have an action to trigger an event to send a notification, and I have Parm2 configured to populate the flow variable with my list.

 

Upon testing, I noticed Parm2 only populates if my Flow Variable has one Serial Number. If there are multiple serial numbers, Parm2 is empty. 

assetList2.pngassetList.png

var gr = fd_data._8__look_up_records.records;
var serialNumberList_array = [];
 while(gr.next()){
        serialNumberList_array.push(gr.getValue('u_serial_number'));
 } 
 var serialNumberList = serialNumberList_array.join();
 var snList = JSON.stringify(serialNumberList_array);
 var sNumberList = serialNumberList_array.toString();
 
 return serialNumberList;

 I've tried using several different methods to convert the array to a string, but it still won't populate into Parm2. 

 

Perhaps the issue isn't with my code, but it could be with my flow. Here is a screenshot where I am cycling through the iterations and any iteration > 1 has the flow variable empty. Why is this?

loops.png

1 REPLY 1

Hristo Ivanov
Kilo Sage
Kilo Sage

Did you try changing the type of parm 2/flow variable to array and try using a for each action?