Populate Glide List on Parent table with data from child table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2017 01:12 AM
Hello All,
I have two tables, lets just call them Parent & Child
On the parent table I have a List Field which references table_x (u_channels)
On the child table I have a reference field which also references table_x (u_channel)
The child table is workflow driven, when it gets to a point in the workflow, I want to add the data from the u_channel field on the child table to the u_channels field on the parent table.
I need to do this via the workflow on the child table but I cant figure out the best way to do it.
Can anyone help?
Thanks
Harry
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2017 01:50 AM
If you're looking for a parent-child style relationship, I think it would be better to use a Reference Field and Related List.
Just go to 'Related Lists' and add "Parent -> Child".
It may even be an idea to add it as an embedded list.
Example: I want to relate child Changes to a parent Change.
Step 1 - Create reference field called 'Related change'
Step 2 - Add related list 'Related change -> Change Request'
Usage: Click Edit to on related list to related children.
Populate 'Related change' field to associate change to parent.
No need for any scripts or business rules.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2017 01:56 AM
Hi Paul,
I already have these set up on related lists but I still require them to be added to the glide list on the parent record.
Thanks
Harry

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2017 02:08 AM
I've found the best way to deal with Glide Lists is to
Split the GlideList into an Array
Push a new value
Save the array back in as a string.
Something like this:
var grParent = new GlideRecord('u_channels');
if (grParent.get(current.getValue('u_channels'))) {
//GlideList is stored as a comma seperated string
var arrayOfChannels = current.getValue('u_channel_list').split(',');
//Turn it into an array, then push a new value in
arrayOfChannels.push(current.getValue('sys_id'));
grParent.setValue('u_channel_list', arrayOfChannels);
//Save the parent
grParent.update();
}
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022