- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2015 12:25 AM
Hi I am creating a email template where the Subject line should be as below but I am not getting the Item name.
Table Sysapproval_approver
Service Request REQxxxxx for "Item name" has been Approved
Email Script for Subject:
_________________________________________________________________________________
email.setSubject("Service Request " + $(sysapproval) + " " +"for" + " " + req + "has been approved");
var gr = new GlideRecord("sc_req_item");
gr.addQuery("request", current.sys_id);
gr.query();
while(gr.next())
{
// template.print(gr.cat_item.getDisplayValue() + " ");
var req = gr.cat_item.getDisplayValue();
}
</mail script>
____________________________________________________________________________________
can anyone help where I am wrong in subject why isn't it retrieving the Item Name?
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2015 03:50 AM
Not sure what exactly you are looking for but try the below and use the subject you want ...
<mail script>
var requestNumber = '';
var catalogName = '';
var ritmNumber = '';
var gr = new GlideRecord("sc_req_item");
gr.addQuery("sys_id", current.sysapproval);
gr.query();
if(gr.next())
{
catalogName = gr.cat_item.name.toString();
requestNumber = gr.request.number.toString();
ritmNumber = gr.number.toString();
}
email.setSubject("Service Request " + requestNumber + " " +"for" + " " + catalogName + " has been approved");
//email.setSubject("Service Request " + ritmNumber + " " +"for" + " " + catalogName + " has been approved");
</mail script>
Note : The template must be running on sysapproval_approver
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2015 01:28 AM
Yes , its should work .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2015 02:34 AM
So if it is as below:
Notification table is : sysapproval_approver
&
Email Template: sysapproval_approver
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2015 03:15 AM
In Notification template you are using only sysapproval_approver 's sys_id to retrieve the data from sc_req_item table so you just need to have Email Template table: sysapproval_approver
The notification table may effect the fields like to whom you are sending the notification... Like if you are sending the notification to requester and notification table is request then in 'who will receive' field should have Requester (caller id) in it but if notification is on sysapproval_approver table then you have to replace it with Approval for.requester (sysapproval.caller_id) .
Use it according to your need.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2015 03:33 AM
Thanks for the clarification