- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2018 03:45 PM
On my Project table, I have a glide_list field that is referencing a now deleted reference entry (now displays as a sys_id). I've been able to query for all Projects that contain this entry in that field, but I'd like to use a background script to replace this sys ID entry with a different value. Any help is appreciated.
Thank you
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2018 02:16 AM
I would use the ArrayUtil-Script include to parse the current values of your glide_list to an array. Also in ArrayUtil you can do the search to find the proper place of the old value and replace it.
Other option - since a glide_list is just a comma-separated string - is a simple replace command. I.e.
var my_list_string = gr.some_field + ''; // adding an empty string to force type conversion
my_list_string.replace(old_sys_id, 'New value');
gr.some_field = my_list_string:
gr.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2018 03:24 PM
Got it working with some HI support staff help that I kicked off before this forum post... had to change:
my_list_string.replace(old_sys_id, 'New value');
to be
my_list_string = my_list_string.replace(old_sys_id, 'New value');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2018 09:47 PM
Hi,
ArrayUtil API is a script include with useful functions for working with JavaScript arrays. In this case first parse the current values of your glide_list to an array then use replace() method to replace the new value from old value.
Thanks,
Nikhil Dixit