Notification Email Scripts

Aswin Chandras1
Tera Contributor

Hi All,

 

I have written a e-mail script to display the incident summary in the notification.

 

Email script:

var incident_record = current.sysapproval.getRefRecord();
if(incident_record){
    template.print("<table>");
    template.print("<tr><td><strong>Caller:</strong></td><td>" + incident_record.caller_id.getDisplayValue() + "</td></tr>");
    template.print("<tr><td><strong>Assignment group:</strong></td><td>" + incident_record.assignment_group.getDisplayValue() + "</td></tr>");
    template.print("<tr><td><strong>Assigned to:</strong></td><td>" + incident_record.assigned_to.getDisplayValue() + "</td></tr>");
    template.print("</table>");
    template.print("<div><strong>Description:</strong></div><div>" + incident_record.description + "</div>");
    template.print("<div>&nbsp;</div>");
 
 
Notification:
${mail_script:cf_incident_mim_approval_summary}
 
But it is not coming as expected.
 
9 REPLIES 9

Hi @Ankur Bawiskar 

 

I tried using the above script but it is not coming as expected.

 

Yes notification is on sysapproval_approver table.

 

Attaching snip for reference.

 

${mail_script:cf_incident_mim_approval_summary}

AswinChandras1_1-1756912947523.png

 

AswinChandras1_0-1756912902433.png

 

@Aswin Chandras1 

did you add gs.info() in email script and check what came for GlideRecord?

Is it going inside that GlideRecord IF?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar 

 

It is not going inside gliderecord IF

@Aswin Chandras1 

did you check current.sysapproval gave you sysId or not?

Try to use current.document_id and see if it gives you INC sysId then use that in query

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Bhuvan
Tera Sage

@Aswin Chandras1 

 

Refer below for sample,

 

https://www.servicenow.com/community/developer-forum/accessing-notification-type-from-inside-an-emai...

 

If this helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan