How to assign multiple values to a list field

sk59
Tera Expert

Hi,

I am getting some list of ID's by querying a table, now i need to assign all those ID's to a list field.

Please let me know how can i achieve this.

Thanks in Advance

1 ACCEPTED SOLUTION

you need to do it like this



var arr = [];


var allChildRecords = new GlideRecord('sc_request');


  allChildRecords.addQuery('parent', parentSysId);


  allChildRecords.query();


  while(allChildRecords.next()){


        arr.push(allChildRecords.getValue('sys_id'));


      }



current.list_field = arr.join(',');


View solution in original post

5 REPLIES 5

you need to do it like this



var arr = [];


var allChildRecords = new GlideRecord('sc_request');


  allChildRecords.addQuery('parent', parentSysId);


  allChildRecords.query();


  while(allChildRecords.next()){


        arr.push(allChildRecords.getValue('sys_id'));


      }



current.list_field = arr.join(',');