Parent and Child Script within Relationship Types

Not applicable

We have been leveraging the cmdb Related Items field withing incident and change within our instance.

Using the task relationships application I have set several different relationship types. Within those types are two fields called "parent script" and "child script".

I have been trying to pass values in the parent task to the child task within these fields but have been unsuccessful.

The code I have been using is:
child.u_value = parent.u_value;

This does not seem to be working. Does anyone have experience passing values within the related item field?

3 REPLIES 3

Valor1
Giga Guru

Where are you running the script, and what object are you trying to update? what you do changes based on the relative location of the script.

You will probably have to do a GlideRecord query to return the object you want to update, like so:
var gr = new GlideRecord('parents_table');
gr.addQuery('sys_id',current.parent);
gr.query();
if(gr.next()){
gr.field_value = current.field_value;
gr.update();
}


Not applicable

You can also dot-walk as parent is a reference:


current.parent.u_value


sarat5
Kilo Contributor

For others like me who don't know what a dot-walk is, see this wiki:
http://wiki.service-now.com/index.php?title=Dot-Walking