- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 01:19 PM
Hello Folks,
How can I get the requested Item state for the email notification, so that if the state is closed complete, I can print the closed by. If the state is closed skipped/closed Incomplete. I can print the reason.
(var ritm = new GlideRecord('sc_req_item');
if (ritm.get(current.request_item)) {
if (ritm.state == 3) {
var Summary = gs.getMessage('Summary details');
var ClosedBy = gs.getMessage('Closed by: {0}', '${closed_by}');
template.print('<p><font size="4" <strong>' + 'Request Approved' + '</strong></font></p>');
template.print('<p><font size="4" color="#808080" face="helvetica"><strong>' + Summary + '</strong></font></p>');
template.print('<p><font size="3" color="#808080" face="helvetica">' + ClosedBy + '</font></p>');
}
if (ritm.state == 4 || 7) {
{
var Summary1 = gs.getMessage('Summary details');
var ClosedBy1 = gs.getMessage('Closed by: {0}', '${closed_by}');
template.print('<p><font size="4" color="#808080" face="helvetica"><strong>' + 'Request Canceled' + '</strong></font></p>');
template.print('<p><font size="4" color="#808080" face="helvetica"><strong>' + Summary1 + '</strong></font></p>');
template.print('<p><font size="3" color="#808080" face="helvetica">' + ClosedBy1 + '</font></p>');
}
} else {
return;
}
}
})(current, template, email, email_action, event);
Thanks
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 01:41 PM
If you have created the notification also on ritm table you can directy get it using
current.state
No need to glide the table
Please mark answer correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 01:27 PM
Hello
Replace if (ritm.get(current.request_item)) with
if (ritm.get(current))
And
Replace if (ritm.state == 4 || 7) {
with if (ritm.state == 4 || ritm.state==7) {
Please mark answer correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 01:37 PM
Thanks for the reply Saurav,
I'm not actually get the state value into the if condition, so the conditions doesn't work at all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 01:41 PM
If you have created the notification also on ritm table you can directy get it using
current.state
No need to glide the table
Please mark answer correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 01:47 PM
Thanks Saurav! That actually worked