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.

How to get list collector values and populate in string field

keerthilatha
Tera Expert

Hi Team,

I have to get list collector values and populate in string field in other table how can i achieve it.

16 REPLIES 16

Dubz
Mega Sage

Use this:



var list = your_field_name_here.toString();


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


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


gs.log("Reference value is: " + array[i]);


}


hi david,


I have to show the selected values in my custom table from record producer where do i need to write script for this


That script will take the sys-id's in a glide_list field and add them to an array, then you can do with them whatever you want, add your code within the for section



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


gs.log("Reference value is: " + array[i]);


//add your code here


}



If you want to get the display value simply change the first line as below:



var list = your_field_name_here.getDisplayValue();


better approach.