Pulling the fields through from another table into a Notification email body
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2024 07:41 PM
How would I pull a field through from one table into a notification template or email based on another table?
I'm trying to pull through the details of a Affected Ci (task_ci table) fields as technology manager ; name and put them in an notification email template (change_request table).
and I'm not sure what the syntax would be to do this, I've tried various variations on ${table name.field name} but nothing seems to be working.
Any ideas?
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2024 03:00 AM
hi @sureshpcse ,
you can refer below email script but need to modify the field according to the technology manager. believing that you have created the notification on the change table so
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var taskci = new GlideRecord("task_ci");
taskci.addQuery("task", current.sys_id);
taskci.query();
while (taskci.next()) {
var gr1 = new GlideRecord("cmdb_ci")
gr1.addQuery("sys_id", taskci.ci_item);
gr1.query();
if (gr1.next()) {
template.print("OWNED BY IS : " + gr1.getDisplayValue('owned_by')); // add your field name here
}
}
})(current, template, email, email_action, event);
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful."
Thanks,
BK