Trigger Email notification when approval is requested in RITM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-01-2024 09:30 AM
I want trigger a email notification when approval is requested for RITM and the email should contain Requested for should be the requested for of the RITM Opened by should be the opened by of the RITM Priority, State and Short Description should be the one from the Catalog Task Description should be the one of the RITM.
But the thing is condition is being written in sysapproval_approver table and a script also. But the notification is fetching wrong information while triggering email.
Script is:-
/* Optional Email Outbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var target Obj;
if (current.getTableName() == "sysapproval_approver") {
var grCurrent = new GlideRecord(current.source_table);
grCurrent.get(current.document_id);
if (grCurrent) {
target Obj = grCurrent;
}
} else if (current.getTableName() == "sc_task") {
target Obj = current.parent;
} else {
target Obj = current;
}
var req_for = new NEOPS_NotificationUtils().getRequest edForforTable(target Obj);
var description = new NEOPS_NotificationUtils().getDescription porTable(target Obj);
template.print('<p><span style="font-size: 11pt; font-family: verdana, geneva;"><strong>Approval details</strong><strong><br /></strong></span></p>');
template.print('<table style="border-collapse: collapse; font-family: Arial, Helvetica, sans-serif; color: #306392; font-size: 10pt; font-weight: normal; width: 100%;">');
template.print('<tbody>');
template.print('<tr style="vertical-align: top;">');
template.print('<td style="width: 32.7927%;"><strong><span style="font-size: 10pt; font-family: verdana, geneva;">Requested for:</span></strong></td>');
template.print('<td style="width: 67.2073%;"><span style="font-size: 10pt; font-family: verdana, geneva;">' + req_for + '</span></td>');
template.print('</tr>');
template.print('<tr style="vertical-align: top;">');
template.print('<td style="width: 32.7927%;"><strong><span style="font-size: 10pt; font-family: verdana, geneva;">Opened by: </span></strong></td>');
template.print('<td style="width: 67.2073%;"><span style="font-size: 10pt; font-family: verdana, geneva;">${sysapproval.opened_by}</span></td>');
template.print('</tr>');
template.print('<tr style="vertical-align: top;">');
template.print('<td style="width: 32.7927%;"><strong><span style="font-size: 10pt; font-family: verdana, geneva;">Priority:</span></strong></td>');
template.print('<td style="width: 67.2073%;"><span style="font-size: 10pt; font-family: verdana, geneva;">${sysapproval.priority}</span></td>');
template.print('</tr>');
template.print('<tr style="vertical-align: top;">');
template.print('<td style="width: 32.7927%;"><strong><span style="font-size: 10pt; font-family: verdana, geneva;">State:</span></strong></td>');
template.print('<td style="width: 67.2073%;"><span style="font-size: 10pt; font-family: verdana, geneva;">${sysapproval.state}</span></td>');
template.print('</tr>');
template.print('<tr style="vertical-align: top;">');
template.print('<td style="width: 32.7927%;"><strong><span style="font-size: 10pt; font-family: verdana, geneva;">Short Description: </span></strong></td>');
template.print('<td style="width: 67.2073%;"><span style="font-size: 10pt; font-family: verdana, geneva;">${sysapproval.short_description}</span></td>');
template.print('</tr>');
template.print('<tr style="vertical-align: top; height: 19px;">');
template.print('<td style="width: 32.7927%;"><strong><span style="font-size: 10pt; font-family: verdana, geneva;">Description:</span></strong></td>');
template.print('<td style="width: 67.2073%;"><span style="font-size: 10pt; font-family: verdana, geneva;">' + description + '</span></td>');
template.print('</tr>');
template.print('</tbody>');
template.print('</table>');
})(current, template, email, email_action, event);
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2024 02:20 AM
Hello @1_DipikaD,
Please refer to the below link:
https://www.servicenow.com/community/developer-forum/when-a-ritm-is-raised-an-email-notification-sho...
If it is helpful, please mark it as helpful and accept the correct solution.
Thanks & Regards,
Abbas Shaik