- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 05:43 AM
Need to get the requested item & catalog item name in notification body & subject. This notification is taken on request table.
help me the way to fulfill this.
Thank you.
Solved! Go to Solution.
- Labels:
-
Request Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 05:48 AM
Hi,
Since notification is on request table you need a mail script. Try something as below.
System Notification >> Email >> Notification Mail script.
Create New: getritmdetails
with script as below
(function runMailScript(current, template, email, email_action, event) {
var getritm = new GlideRecord('sc_req_item');
getritm.addQuery('request', current.sys_id);
getritm.query();
if (getritm.next()) {
template.print('Requested Item: ' + getritm.number);
template.print('Catalog Item: ' + getritm.cat_item.getDisplayValue());
}
})(current, template, email, email_action, event);
Call mail script in notification body field as below
${mail_script:getritmdetails}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 05:48 AM
Hi,
Since notification is on request table you need a mail script. Try something as below.
System Notification >> Email >> Notification Mail script.
Create New: getritmdetails
with script as below
(function runMailScript(current, template, email, email_action, event) {
var getritm = new GlideRecord('sc_req_item');
getritm.addQuery('request', current.sys_id);
getritm.query();
if (getritm.next()) {
template.print('Requested Item: ' + getritm.number);
template.print('Catalog Item: ' + getritm.cat_item.getDisplayValue());
}
})(current, template, email, email_action, event);
Call mail script in notification body field as below
${mail_script:getritmdetails}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 05:55 AM
For subject add
email.setSubject('RITM is '+getritm.number +' Catalog item '+getritm.cat_item.getDisplayValue());
just before
}
& after template.print ....
from earlier comments.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 06:31 AM
Hi jaspal,
In email script, have to mention this. when i take this in subject it showing only the catalog item.
I need to show the subject as "Request ${number} for (here catalog item come) has been opened on your behalf".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 06:53 AM
Hi
I believe Jaspal provided the solution, but if you want to set the subject as you expected.
Just update the line like below but mark the Jaspal solution as correct:
email.setSubject('Request is '+getritm.request+' for '+getritm.cat_item.getDisplayValue() +' has been opened on your behalf');
Thanks
Murthy
Murthy