Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Can you dot-walk from child to parent record in Notification email script

MKelly83
Giga Expert

Hi guys

Trying to cc an user from a field on the parent table. The notification is triggered from the child table.

Notification email script

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,

/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,

/* Optional GlideRecord */ event) {

email.addAddress("cc",current.u_Child_table_name.u_Parent_table_name.u_pm.email,current.u_Child_table_name.u_Parent_table_name..u_pm.name);

})(current, template, email, email_action, event);

Output

Copied = undefined

find_real_file.png

many thanks

Michelle

1 ACCEPTED SOLUTION

MKelly83
Giga Expert

In above case


current.u_Child_table_name.u_Parent_table_name.email   'current' refer to u_Child_table_name so I didn't need to add u_Child_table_name



final script that worked



(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,


/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,


/* Optional GlideRecord */ event) {


  1. email.addAddress("cc",current.u_Parent_table_name.u_pm.email,current.u_Parent_table_name..u_pm.name);

})(current, template, email, email_action, event);



View solution in original post

3 REPLIES 3

Anurag Tripathi
Mega Patron
Mega Patron

Hi Michelle,



If u_Child_table_name is a reference field then the dot walk should be possible.


-Anurag

Thanks for your reply Anurag.



yes the field is a reference field. It references the user table.



I have been able to do this using similar script when cc'ing users from the parent table but when triggering from the child table I am getting Undefined.


MKelly83
Giga Expert

In above case


current.u_Child_table_name.u_Parent_table_name.email   'current' refer to u_Child_table_name so I didn't need to add u_Child_table_name



final script that worked



(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,


/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,


/* Optional GlideRecord */ event) {


  1. email.addAddress("cc",current.u_Parent_table_name.u_pm.email,current.u_Parent_table_name..u_pm.name);

})(current, template, email, email_action, event);