- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2023 11:17 AM
I am trying to add/append a new value to List collector using GlideRecord script. My initial approach is to read/add the existing value to an array and then add the new value to same array and then write the array value back to the list collector.
so I am reaching out to see if there are any other efficient way of appending data to list collector without overwriting it.
thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2023 11:29 AM
Below is a sample script of how to append data to a list collector.
var exampleRecord = new GlideRecord("example_table");
// query conditions
exampleRecord.query();
if(exampleRecord.next()) {
var listCollectorValues = exampleRecord.getValue("field_name").split(','); // split the comma separated string into an array
listCollectorValues.push(newValue); //append the new value to the array
exampleRecord.setValue("field_name", listCollectorValues.toString()); //conver the array back to a string
exampleRecord.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2023 11:29 AM
Below is a sample script of how to append data to a list collector.
var exampleRecord = new GlideRecord("example_table");
// query conditions
exampleRecord.query();
if(exampleRecord.next()) {
var listCollectorValues = exampleRecord.getValue("field_name").split(','); // split the comma separated string into an array
listCollectorValues.push(newValue); //append the new value to the array
exampleRecord.setValue("field_name", listCollectorValues.toString()); //conver the array back to a string
exampleRecord.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2023 11:43 AM
That is very nice!
Thank you very much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2024 11:17 PM
We can append an existing list collector in a simple way.
We can see that there is only one record in the above pasted image.
By using the syntax like : gr.work_notes_list += ',
Use the append symbol(+=) and make sure to start entering your sys_ids with a comma(,).