- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2016 12:50 AM
I have a great script sourced from a range of posts here, which is working very nicely to pull through ALL the variables for the Requested Item
template.print("<b><u>Summary of Requested items:</u></b><br/>");
var item = new GlideRecord("sc_req_item");
item.addQuery("sys_id", current.request_item); //item.addQuery("sys_id", current.sysapproval); //for catalog approval
item.query();
while(item.next()) {
template.print(item.number + ": " + item.quantity + " X " + item.cat_item.getDisplayValue() + "<br/>");
template.print("<br/>Options: <br/>");
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.getLabel() != "" && vs.getDisplayValue() != "" && vs.getDisplayValue()!='false') {
//template.space(3);
template.print("<br/> <b>" + vs.get(i).getLabel() + "</b> = " + vs.get(i).getDisplayValue() + "");
}
}
}
However, my workflow is only pulling through the respective variables to each task so that the teams are not flooded with irrelevant information.
The challenge today is these teams are not on board in the tool and wont be fulfilling the tasks online. They will be receiving an email as a result of the task assignment to their group mailbox.
Once complete they will respond back. This is a stepping stone to automate an otherwise convoluted procedure.
Thus I would like to ONLY pull through the variables into the Email Notification which belong to the Task and not the Requested Item!?
The script above is a Notification Email Script and works very well at the point of group assignment for the task. Any clues how I can restrict the content to variables attached to the task?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2016 08:33 AM
after
set.setRequestID(SYSID OF REQUESTED ITEM);
I also added:
set.setTaskID(SYSID OF REQUESTED ITEM TASK);
this is now limiting the values specific to the task!
template.print("<b><u>Summary of Requested items:</u></b><br/>");
var item = new GlideRecord("sc_req_item");
item.addQuery("sys_id", current.request_item);
item.query();
while(item.next()) {
template.print(item.number + ": " + item.quantity + " X " + item.cat_item.getDisplayValue() + "<br/>");
template.print("<br/>Options: <br/>");
var keys = new Array();
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(item.sys_id);
set.setTaskID(current.sys_id);
set.load();
var vs = set.getFlatQuestions();
for (var i=0; i < vs.size(); i++) {
//if (vs.getLabel() != "" && vs.getDisplayValue() != "" && vs.getDisplayValue()!='false' && vs.visible == true) {
if (vs.getLabel() != "" && vs.getDisplayValue() != "" && vs.getDisplayValue()!='false' && vs.get(i).getDisplayValue()!= 'false' && vs.get(i).getDisplayValue()!= '') {
//template.space(3);
template.print("<br/> <b>" + vs.get(i).getLabel() + "</b> = " + vs.get(i).getDisplayValue() + "");
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2016 03:16 AM
OK but that sounds like hard coding? I want a single script to pull through the variables for each task at the point of assignment...
I know they are identical but there must be a reference which ties the task variables to the original request item variables?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2016 06:04 AM
Looks like sc_item_variables_task contains task.sys_id and item_option_new.variable
I am not yet clear how to cycle through where the values for these are stored
I need to better understand how GlideappVariablePoolQuestionSet works and what inputs it has, as it seems that will take the requested item as an input and load all the questions. Would it work for set.setRequestID(item.sys_id); using task.sys_id ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2016 08:33 AM
after
set.setRequestID(SYSID OF REQUESTED ITEM);
I also added:
set.setTaskID(SYSID OF REQUESTED ITEM TASK);
this is now limiting the values specific to the task!
template.print("<b><u>Summary of Requested items:</u></b><br/>");
var item = new GlideRecord("sc_req_item");
item.addQuery("sys_id", current.request_item);
item.query();
while(item.next()) {
template.print(item.number + ": " + item.quantity + " X " + item.cat_item.getDisplayValue() + "<br/>");
template.print("<br/>Options: <br/>");
var keys = new Array();
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(item.sys_id);
set.setTaskID(current.sys_id);
set.load();
var vs = set.getFlatQuestions();
for (var i=0; i < vs.size(); i++) {
//if (vs.getLabel() != "" && vs.getDisplayValue() != "" && vs.getDisplayValue()!='false' && vs.visible == true) {
if (vs.getLabel() != "" && vs.getDisplayValue() != "" && vs.getDisplayValue()!='false' && vs.get(i).getDisplayValue()!= 'false' && vs.get(i).getDisplayValue()!= '') {
//template.space(3);
template.print("<br/> <b>" + vs.get(i).getLabel() + "</b> = " + vs.get(i).getDisplayValue() + "");
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-12-2016 02:01 PM
I have two different mail scripts now
one for RITM approvals and other for CTASKs
the task ID is easily accessible
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2016 02:55 PM
What was your mail script specifically for catalog task? My workflow's catalog tasks have certain variables set on them, to give the appropriate assignment groups only the variables relevant to their work - this is what I want to include in my task notification emails.