- 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 10:19 AM
Hi Shane, you can try with the following change in line 3
instead of having... :
item.addQuery("request", current.sysapproval);
try... :
item.addQuery("request", current.request);
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2015 11:04 AM
Berny,
That worked perfect! Thank you very much for your help. I will mark your solution as the correct answer.
Shane
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2015 12:34 PM
Berny,
I responded too quick regarding exactly what I need. The code below is great for listing ALL RITM information from a request. However, in this case, I only want the catalog task email to show the parent RITM the task is associated with. I appreciate your help. Thank you.
item.addQuery("request", current.request);
- 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