How to include related list table field in email notification

Hareesha
Tera Contributor

I am working on email notification.I have a requirement to include a fields which is in related list table.

2 REPLIES 2

Sagar Pagar
Tera Patron

Hi,

You have to GlideRecord the related list table in email scripts, add/prints the required columns/fields.

Call email script in email notifications.

 

Take a reference of old the read -  Related list records in notification

and Scripting for email notifications

 

Feel free to mark it as helpful and correct!

Thanks,

Sagar Pagar

The world works with ServiceNow

AparnaSahu
Tera Guru

Create mail scripts in System Policy > Email > Notification Email Script->

(function runMailScript(current, template, email, email_action, event) {

 

  var item = new GlideRecord("sc_req_item");

 

  item.addQuery("request", current.sys_id);

 

  item.query();

 

  while(item.next()) {

 

  var catalogItem = item.number + ': ' + item.cat_item.getDisplayValue();

 

  var misc = item.variable_pool.alt_poc;

 

  template.print(catalogItem + "<br/> Field: " + misc);

 

  }

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

 

Now you can call the above mail script in email notification as ${mail_script:script name}