
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2019 06:10 AM
Hello everyone,
I am trying to customize an approval email notification with variables from a requested item. I modified the requested_items_summary_with_options email script with the requested item's sys_id. I then called the mail script in the notification email but the variables show up blank when the manager receives the email.
Here is the notification data I am putting in the body:
Request Type: ${variables.request_type}
Report Title: ${variables.report_title}
Description of Report: ${variables.description_of_report}
Urgency: ${variables.urgency}
Requested Due Date: ${variables.requested_due_date}
${mail_script:approval_items_summary}
${sysapproval.description}
${mailto:mailto.approval}
${mailto:mailto.rejection}
Click here to view ${sysapproval.sys_class_name}: ${sysapproval.URI}
The mail_script approval items are showing up as intended, but the variables from the requested item are not. I tried creating an email template and importing that but I achieved the same results. I attached some screenshots to help provide clarity. Any and all help is greatly appreciated. Thank you for your time!
From,
Chris
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2019 07:28 AM
Also Can you replace setReqwuestID line with
set.setRequestID(current.getValue('sysapproval'));

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2019 08:29 AM
Is this approval notification for only single catalog item or all the catalog items?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2019 09:31 AM
The approval would only be for a single catalog item. The manager wants customized notifications so she can see what the variables are in the form in the email before she logs into ServiceNow.
I am assuming that I would specify the variables I want to see in the email script? Maybe in this line?
while(item.next()) {
template.print(item.number + ": " + item.quantity + " X " + item.cat_item.getDisplayValue() + " at " + item.cat_item.price.getDisplayValue() + " each <br />");
I tried replacing the item.number with variable.requesting_user but it did not work.
Thank you again for all of your assistance?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2019 10:13 AM
If we talking about 2-3 fields then I would just add it in the if contions
if(vs.get(i).getLabel() != '' && vs.get(i).getLabel() == 'YOUR_LABEL_NAME1' && vs.get(i).getLabel() == 'YOUR_LABEL_NAME2' ) {
If you more than that and you foresee that more variables can be added to it. Then I would create a system property and call it in the script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2019 10:15 AM
That worked perfectly. Thank you for all of your help dvp. I greatly appreciate it!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2019 10:27 AM
You are welcome 🙂