Pulling the field through from another table into a Notification email body

sureshpcse
Tera Contributor

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?

1 ACCEPTED SOLUTION

Bhavya11
Kilo Patron

Hi @sureshpcse 

 

If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful."

View solution in original post

4 REPLIES 4

Bhavya11
Kilo Patron

hi @sureshpcse ,

 

you can try below code in email scrip as your notification was created on the Change table

 

(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
    /* Optional EmailOutbound */
    email, /* Optional GlideRecord */ email_action,
    /* Optional GlideRecord */
    event) {

    //          var recComments = current.comments.getJournalEntry(3);
    //  var formattedComments = recComments.replace(/\n/g, "<br>");
    //  template.print(formattedComments);
   
    var table = current.sys_class_name;
    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')); // change to your field here because in my PDI  i do not have  technology manager field
        }
    }



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

 

 

If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful."

 

Thanks,

BK

Thank you very much for the solution.

Thank you very much

Bhavya11
Kilo Patron

Hi @sureshpcse 

 

If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful."