- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 06:19 AM
Notification written in req table and customer need to RITM number in subject line
If single Req has multiple RITM means i need to show all RITM numbers in subject
Any one help on this, I think I will go for email script but I need any sample script.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 06:33 AM
The script is pretty straightforward. Assuming that the request GR is contained in the "current" variable:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var requestedItems = [];
// Create a new GlideRecord for the 'sc_req_item' table
var requestedItemGR = new GlideRecord('sc_req_item');
// Query for requested items related to the current request
requestedItemGR.addQuery('request', current.getValue('sys_id'));
requestedItemGR.query();
while (requestedItemGR.next()) {
requestedItems.push(requestedItemGR.number.toString());
}
var subject = 'Requested Items Numbers: ' + requestedItems.join(', ');
// Set the subject for the email
email.setSubject(subject);
})(current, template, email, email_action, event);
Create a Notification Email Script and add it in the body of the notification. The "email.SetSubject()" is the part which will set the email subject. You can format the string argument as you desire.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 10:48 PM
requestedItemGR.addQuery('request', current.getValue('sys_id'))
Here how it will pic current sys_id
Here we not given any table right, if in Business rule mean i have have table is current based on table it will pic sys_id
But here in email script how it will pic , can pls explain me