- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2015 11:29 AM
I am trying to put the variable data into the "Email assigned to group (sc_task)" email notification so that the task assignment group will see what has been ordered, but am having no luck. We have it on the Approval Request notification using the Notification Email Script below. Does anyone have your catalog task emails including variable information?
We are on Fuji. All help is appreciated!
template.print("<b>Summary of Requested items:\n</b>");
var item = new GlideRecord("sc_req_item");
item.addQuery("request", current.sysapproval);
item.query();
while(item.next()) { template.print(item.number + ": " + item.cat_item.getDisplayValue() + "\n");
/*template.print("\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).getDisplayValue() != '') {
template.space(4); template.print(' ' + vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "\n");
}
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2015 12:52 PM
No problem. It will be like this then...
template.print("<b>Summary of Requested items:\n</b>");
var item = new GlideRecord("sc_req_item");
if (item.get(current.request_item.sys_id)) {
template.print(item.number + ": " + item.cat_item.getDisplayValue() + "\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).getDisplayValue() != '') {
template.space(4); template.print(' ' + vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "\n");
}
}
}
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2015 01:07 PM
Berny,
Yes, now that is perfect. Thank you!
Shane

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2015 03:27 PM
Hi Berny, I need to be able to print variables in the email notification where Visible on Summaries is set to True. I have multiple workflow variables that print with this code and it doesn't make sense for the approver or requester to see those and they will be blank until the required tasks are completed.
How could I modify this code so that only variables set to Visible on Summaries would print?
Thanks,
Teri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2016 03:34 PM
If you are still looking for this info. I was able to omit any unwanted information by doing the following:
if(vs.get(i).getLabel() != '' && vs.get(i).getLabel() != 'Selected Products' && vs.get(i).getDisplayValue() != '' && vs.get(i).getDisplayValue() != 'null' && vs.get(i).getDisplayValue() != 'false')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2017 11:38 AM
Hi,
Can you please let me know how and where I can use this script to pull variables in task notification?
Regards,
Jitendra Singh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2017 11:42 AM