- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2018 11:29 AM
Currently we have the approval for the Request automatically being approved. But we need an approval for the RITM, catalog item approved by the approving manager. For the RITM, it was setup to use the approval request email, with the change.itil.approve.role, which is incorrect, but with it firing off when approval.inserted we are getting the email but with the incorrect info or not all the info... So I want to user the Catalog Request Approval email, with the request.itil.approve.role that fires off when an approval.inserted. The email is received when using that email template but not all the info is showing. But what I have noticed is that when I preview this notification and put in a RITM is does not show the information, but when I put in a REQ to preview it shows the information that I need. So how do I get the REQ info in the email when the RITM is sent for an approval. Or what am I doing wrong...
When I preview a RITM
When I preview a REQ
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2018 01:32 PM
One correction made. try this
<div>${mail_script:branded_email_header}</div>
<div>Short Description: ${sysapproval.short_description}</div>
<div>Priority: ${sysapproval.priority}</div>
<div>Requested For: ${sysapproval.requested_for}</div>
<div>Requested By: ${sysapproval.opened_by}</div>
<div>Total Price: ${sysapproval.price}</div>
<hr/>
<mail_script>
template.print("Summary of Requested items:\n");
var item = new GlideRecord("sc_req_item");
if (current.sysapproval.sys_class_name == 'sc_request')
item.addQuery("request", current.sysapproval);
else
item.addQuery("sys_id", current.sysapproval);
item.query();
while(item.next()) {
template.print(item.number + ": " + item.quantity + " X " + item.cat_item.getDisplayValue() + " at " +
item.price.getDisplayValue() + " each \n");
template.print(" Options:\n");
var keys = new Array();
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(item.sys_id);
set.load();
var vs = set.getFlatQuestions();
for (var i=0; i < vs.size(); i++) {
if(vs.get(i).getLabel() != '') {
template.space(4);
template.print(' ' + vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "\n");
}
}
}
</mail_script>
Comments:
${sysapproval.description}
<hr/>
${mailto:mailto.approval}
<hr/>
${mailto:mailto.rejection}
<hr/>
Click here to view Approval Request: ${URI}
Click here to view ${sysapproval.sys_class_name}: ${sysapproval.URI}
<div>${mail_script:branded_email_footer}</div>
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2018 12:01 PM
You need to create separate email notifications for each.
If you are sending from Request table, create an email with event as approval.insert and condition as Task.task_type = 'sc_request'
If you are sending from Request table, create an email with event as approval.insert and condition as Task.task_type = 'sc_req_item'
Both of them should have high weight compare to the OOB notification, so that the OOB notification is ignored.
Then in both the notifications, you need to write your own scripts to set the email body.
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2018 12:07 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2018 12:12 PM
Copy the existing email template used in OOB email which is working for Request. And use it in your new notifications.
Let me know, what do you have in that template...Then we can modify....Do you have it in you personal instance or client instance?
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2018 12:34 PM
This is what is in the email notification currently:
<div>${mail_script:branded_email_header}</div>
<div>Short Description: ${sysapproval.short_description}</div>
<div>Priority: ${sysapproval.priority}</div>
<div>Requested For: ${sysapproval.requested_for}</div>
<div>Requested By: ${sysapproval.opened_by}</div>
<div>Total Price: ${sysapproval.price}</div>
<hr/>
<mail_script>
template.print("Summary of Requested items:\n");
var item = new GlideRecord("sc_req_item");
item.addQuery("request", current.sysapproval);
item.query();
while(item.next()) {
template.print(item.number + ": " + item.quantity + " X " + item.cat_item.getDisplayValue() + " at " +
item.price.getDisplayValue() + " each \n");
template.print(" Options:\n");
var keys = new Array();
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(item.sys_id);
set.load();
var vs = set.getFlatQuestions();
for (var i=0; i < vs.size(); i++) {
if(vs.get(i).getLabel() != '') {
template.space(4);
template.print(' ' + vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "\n");
}
}
}
</mail_script>
Comments:
${sysapproval.description}
<hr/>
${mailto:mailto.approval}
<hr/>
${mailto:mailto.rejection}
<hr/>
Click here to view Approval Request: ${URI}
Click here to view ${sysapproval.sys_class_name}: ${sysapproval.URI}
<div>${mail_script:branded_email_footer}</div>