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

sandeep kumar15
Kilo Explorer

(function executeRule(current, previous /*null when async*/ ) {

var list1 = current.u_user_list;
var listlist1=list1.split(',');
for(var i=0;i<listlist1.length;i++){
var gr=new GlideRecord('incident');

gr.addQuery('sys_id',listlist1[i]);
gr.query();
while(gr.next()){
var grr=new GlideRecord('problem');
grr.initialize();
grr.short_description=gr.short_description;
grr.assignment_group=gr.assignment_group;
var id=grr.insert();

gs.addInfoMessage(id);

}

PriyankaC
Kilo Expert

For the original question: How to get the list collector values into a string field this is sufficient: 

var stringField = current.watch_list.getDisplayValue();