- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2018 02:28 PM
Hello all,
We have a catalog item that does not have a Description field when a user is completing the request so when the email notification 'Request Opened on your Behalf" is triggered, the description in the email body is blank. The same goes for when the email notification for the associated task is triggered since the description field is blank.
We would like to see if there is a way to add the catalog item variables (fields from the original request) onto the email notification so the user receives useful information.
I was able to achieve this by adding the variable names onto the message html for the email notification, but since this is something we want to accomplish across multiple catalog items I would like to see if there is a generic script I can use.
Below is what I currently tested:
Thanks in advance!
Grace
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2018 03:30 PM
Hi Grace,
There's an OOB script called 'requested_items_summary_with_options' in the Notification Email Scripts:
template.print("Summary of Requested items:<br />");
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 <br />");
template.print(" Options:<br />");
var keys = [];
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() + "<br />");
}
}
}
Set your item sys_id in the set.SetRequestID line. This will fetch the variable names with their answer, you can modify it as needed.
Once you've modified it, you can add this email script to your notification body by adding ${mail_script:requested_items_summary_with_options} to it.
Hope this helps!
Yeny

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2018 11:43 AM
Hi Grace,
Try putting the sys_id in single quotes. For example: set.setRequestID('4fcf51adfc09240c360b3318110c7f5');. That should work.
Yeny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2018 09:16 AM
Thank you Yeny this fixed my issue!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2019 08:30 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2018 03:37 PM
Since there's a one to many relationship between a request and numerous catalog items, the script is necessary. Yeny provided it, but here is some more info on the topic: Utilizing variable information in notifications
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2018 09:16 AM
Thank you Darius, both you and Yeny were very helpful!