How to add a field from another table in notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2019 08:25 AM
Dear all,
I am working on the email notification on the table name "Assessment Instance [asmt_assessment_instance].
I would like to add a field call "business_case" form another table name "dmn_demand]
I tried to use the following email script but it is not working.
var gr = new GlideRecord("dmn_demand.business_case");
gr.get(current.trigger_id);
template.print("business_case");
I have tried to add the following to the notification message and it's not working as well
Business case: ${dmn_demand.business_case}
I would appreciate your help.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2019 04:14 AM
assuming trigger_id is the ref field on asmt_assessment_instance
this will get you your values:
var gr = new GlideRecord('asmt_assessment_instance'); //trigger_id
gr.query();
while (gr.next()){
gs.print(gr.trigger_id.business_case);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2019 09:17 AM
Hi Brian,
I changed to the following way and it works now but label & value does not stay in the same line (see the picture at below).
Any idea?
<mail_script>
var gr = new GlideRecord("dmn_demand");
gr.get(current.trigger_id);
template.print("Business case:"+gr.business_case);
</mail_script>