- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2016 12:00 PM
The issue is the emails are not showing the correct currency. How do I update the notification and script to ensure the correct currency is displayed for the approver?
The request.itil.approve.role email template has the following:
Short Description: ${sysapproval.short_description}
Priority: ${sysapproval.priority}
Requested For: ${sysapproval.requested_for}
Requested By: ${sysapproval.opened_by}
Total Price: ${sysapproval.price}
${mail_script:request.itil.approve.role_script_1}
Comments:
${sysapproval.description}
${mailto:mailto.approval} via e-mail
${mailto:mailto.rejection} via e-mail
Click here to view Approval Request in ServiceNow: ${URI}
The mail script contains the following code:
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.cat_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");
}
}
}
Thanks!
Solved! Go to Solution.
- Labels:
-
Service Mapping

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2016 12:23 PM
Oops I am sorry, this should go in a mail script. Use this
<mail_script>
template.print(current.sysapproval.price.getCurrencyDisplayValue());
</mail_script>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2016 12:51 PM
Hi Abhinay,
Adding template.print(current.sysapproval.price.getCurrencyDisplayValue()); to a mail script worked!
Thank you.
So now how do I get the mail script I am using to enumerate the requested items to show the correct currency?
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.cat_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");
}
}
}
Thank again!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2016 12:27 PM
try getReferenceValue()
Thanks
prasad kodumuri

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2016 12:35 PM
getReferenceValue() will not work in this use case. getCurrencyDisplayValue() is the method you need to use here.
http://wiki.servicenow.com/index.php?title=Scripting_Currency_and_Price_Fields#gsc.tab=0

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2016 12:23 PM
Oops I am sorry, this should go in a mail script. Use this
<mail_script>
template.print(current.sysapproval.price.getCurrencyDisplayValue());
</mail_script>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2016 12:53 PM
Hi Abhinay,
Adding template.print(current.sysapproval.price.getCurrencyDisplayValue()); to a mail script worked!
Thank you.
So now how do I get the mail script I am using to enumerate the requested items to show the correct currency?
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.cat_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");
}
}
}
Thank again!!!