- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2017 01:34 PM
We have email scripts to print the variables from requested items. Below is one example. I was asked to update it to include checkboxes from the form and I have that working, but the label variables above the checkboxes are not showing in the emails. Does anyone know how I would adjust this to show those?
(function runMailScript(current, template, email, email_action, event) {
for (var key in current.variables) {
var v = current.variables[key];
if ( v.getGlideObject().getQuestion().getDisplayValue()!='' && v.getGlideObject().getQuestion().getDisplayValue()!='false' && v.getGlideObject().getQuestion().getLabel() != 'Workflow' && v.getGlideObject().getQuestion().getLabel() != 'Requested for' && v.getGlideObject().getQuestion().getLabel() != 'Phone number') {
template.space(4);
var dv = v.getGlideObject().getQuestion().getDisplayValue();
if (dv.indexOf(',') > -1 && v.getGlideObject().getQuestion().getType() != 2){
template.print(' ' + v.getGlideObject().getQuestion().getLabel() + ': ' + "</br>");
var array = dv.split(',');
for(var a = 0; a < array.length; a++){
template.space(8);
template.print(array[a] + "</br>");
}
}
else{
template.print(' ' + v.getGlideObject().getQuestion().getLabel() + " = " + v.getGlideObject().getQuestion().getDisplayValue() + "<br/>");
}
}
}
})(current, template, email, email_action, event);
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2017 02:45 PM
I added a log to my script to see what was found in the variable pool and found that the label variables aren't captured in the variable pool. I'm working with my team to adjust how we label the checkboxes so the email is clearer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2017 03:06 PM
Lable must be a different variable, have you included in the mail script?
Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2017 05:50 AM
Hi Deepa - It is another variable, though I can't see anything in my script that would exclude it from the variable pool. Are label variables not captured in the pool?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2017 10:52 AM
ya it shouldn't be excluded, it must be coming separately and not with check box values...can you provide screenshot to confirm my understandng that you are referring label of checkbox variable.
Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2017 12:13 PM
The checkbox variables' labels are showing in the resulting script, what I'm missing are the label variables, which act as headers for the checkboxes. For example, we have a label for "Toner" and checkboxes under that for each color available, then we have a label for "Imaging" and checkboxes for each color under that. My script pulls in the checkboxes that are "true" and shows their label (so the color), but the label variables "Toner" and "Imaging" are not showing.