How to update glide list field through a script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2020 11:06 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2020 11:23 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2020 02:09 PM
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2020 03:04 PM
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.