- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 02:42 PM
Hello,
I would like to add more info to the "Request was opened" OOB notification. The notification is on the sc_request table and seems like all the information is on the sc_req_item table. I looked at potentially adding a notification script that looks at the sc_req_item table but having never done this before wasn't sure where to start. All I want is the notification to include the short description from the RITM if possible.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 03:40 PM
OK here you can start with.
Step 1: open notification and add mailscript like in following screenshot:
In this step we have added a mail script of name 'getRITMDetails'.
Step 2: Create mail script of name 'getRITMDetails' under system notifications > Notification Email Script > create new
it should look like this:
script:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here\
var getRITM = new GlideRecord('sc_req_item');
getRITM.addQuery('request', current.sys_id);
getRITM.query();
if (getRITM.next()) {
template.print('<div style="font-size: 15pt; line-height:30px; padding-bottom:16px"><b style="font-weight:600">The short description from RITM is ' + getRITM.short_description +'</b></div>');
}
})(current, template, email, email_action, event);
In this step we have added a mail script and if you see on line number 12, template.print() is the method which will be writing the short description along with text specified.
Now you can add more field details from sc_req_item just like this using template.print() method.
Once you are done test it 🙂
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 03:40 PM
OK here you can start with.
Step 1: open notification and add mailscript like in following screenshot:
In this step we have added a mail script of name 'getRITMDetails'.
Step 2: Create mail script of name 'getRITMDetails' under system notifications > Notification Email Script > create new
it should look like this:
script:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here\
var getRITM = new GlideRecord('sc_req_item');
getRITM.addQuery('request', current.sys_id);
getRITM.query();
if (getRITM.next()) {
template.print('<div style="font-size: 15pt; line-height:30px; padding-bottom:16px"><b style="font-weight:600">The short description from RITM is ' + getRITM.short_description +'</b></div>');
}
})(current, template, email, email_action, event);
In this step we have added a mail script and if you see on line number 12, template.print() is the method which will be writing the short description along with text specified.
Now you can add more field details from sc_req_item just like this using template.print() method.
Once you are done test it 🙂
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2023 09:20 AM
This was 100% what I wanted. Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 04:22 PM
.. @dustinjones
Regards,Sushant Malsure