- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2022 01:31 PM
I want to run an advanced business rule where a list collector updates its child record with the same value on the child's respective list collector. If I pull the value from the parent and then set the value to the child field, it updates but is blank rather than updated. What are the steps to do this in a business rule script?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2022 03:47 PM
List collectors are "fun" to play with. When you get the data from the field, don't use getDisplayValue(), just use getValue() or just current.field to get the underlying sys_ids of the list of records in the field. Convert that retrieved value to a string as well. Once you have that, you should just be able to put that value into the field of the child record (setValue('field', listCollector)) and do child.update().
var childRec = new GlideRecord('child_table')
childRec.get(current.child_field);
var parentList = current.listCollector_field.toString(); //or current.getValue('listCollector_field').toString();
childRec.listCollector_field = parentList;
childRec.update()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2022 03:47 PM
List collectors are "fun" to play with. When you get the data from the field, don't use getDisplayValue(), just use getValue() or just current.field to get the underlying sys_ids of the list of records in the field. Convert that retrieved value to a string as well. Once you have that, you should just be able to put that value into the field of the child record (setValue('field', listCollector)) and do child.update().
var childRec = new GlideRecord('child_table')
childRec.get(current.child_field);
var parentList = current.listCollector_field.toString(); //or current.getValue('listCollector_field').toString();
childRec.listCollector_field = parentList;
childRec.update()