How to update glide list field through a script

sam43
Tera Contributor

find_real_file.png

 

 

How to update this glide_list field through a background script for 100 records?

3 REPLIES 3

SanjivMeher
Kilo Patron
Kilo Patron

var gr = new GlideRecord('table_name');

gr.addQuery('<add query to update the number of records you want to update>');

gr.query();

 

while (gr.next())

{

gr.field_name = '<sysid 1>,<sysid 2>';

gr.update();

}


Please mark this response as correct or helpful if it assisted you with your question.

How  to keep the old user and add new user in the list field.

 

when i run the above script, old data is replacing with new one?

var gr = new GlideRecord('table_name');

gr.addQuery('<add query to update the number of records you want to update>');

gr.query();

 

while (gr.next())

{

if (gr.field_name)

gr.field_name =gr.field_name+ ',<sysid 1>,<sysid 2>';

else

gr.field_name = '<sysid 1>,<sysid 2>';

gr.update();

}


Please mark this response as correct or helpful if it assisted you with your question.