Moving variable change from child to parent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2018 07:25 AM
Good Morning,
I have two custom tables currently. The record producer I have writes a record to table 1 and the workflow contained in it also spawns off a task to table 2. I have managed to map variables from the parent (table 1) to the child (table 2) but I am needing to make it so that when I change a field in the child it will map up to the parent. I tried to use a business rule: parent.variables.u_subaccount = current.subaccount - However this is not mapping the field. Any suggestions would be greatly appreciated.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2018 08:11 AM
If you're setting a value on a variable associated with the parent record from the child record, you can't dotwalk, you have to use GlideRecord. Something like this should work:
var parentRecord = new GlideRecord('name_of_parent_table');
if (parentRecord.get(parent.getValue('sys_id')) {
parentRecord.variables.u_subaccount = current.subaccount;
parentRecord.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2018 08:52 AM
Here is what I tried:
function executeRule(current, previous /*null when async*/) {
var parentRecord = new GlideRecord('u_invoice_approvals');
if (parentRecord.get(parent.getValue('sys_id'))) {
parentRecord.variables.u_subaccount = current.u_subaccount;
parentRecord.update();
}
}
Still no go 😞

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2018 09:02 AM
Let's validate some things.
Does the child table have a field named 'parent' that references the parent table or is it called 'u_parent'?
Is the u_subaccount on the child table a field or a variable? If it's a variable that line will need to be:
parentRecord.variables.u_subaccount = current.variables.u_subaccount;
You might also add some logging in there to see if it gets inside the if statement and to make sure that everything has values.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2018 05:17 AM
The child table has a field that links to the parent field. The u_subaccount is a field on the child table that when its created the value is being pulled from the parent table. On the parent table this is a variable that is being filled from the record producer. the Subaccount also references the cmn_cost_center.