- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2018 04:57 AM
Hi Team,
we have an email notification when an item is submitted, here we need to show variables visible on summary.
can any one suggest me how to show variables visible on summary using email script.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2018 05:09 AM
You can use this code in a mail script to print variables. This one assumes the message is on the sysapproval_approver table and gets the variables from the record pointed to by the sysapproval table.
printVars();
function printVars(){
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(current.getValue('sysapproval'));
set.load();
var vs = set.getFlatQuestions();
for (var i=0; i < vs.size(); i++) {
if(vs.get(i).getLabel() != '') {
template.print(' ' + vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "\n");
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2018 12:58 PM
Hi Alexander,
I recommend you send a message to docs@servicenow.com to get it in their queue to document the API.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2018 02:37 PM
Thank you so much ctomasi , given script perfectly working.
i need one more help, i want bold only variable names not for the variable values, please help me on this.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2018 02:47 PM
Do this
printVars();
function printVars(){
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(current.getValue('sysapproval'));
set.load();
var vs = set.getFlatQuestions();
for (var i=0; i < vs.size(); i++) {
if(vs.get(i).getLabel() != '') {
template.print(' <b>' + vs.get(i).getLabel() + "</b> = " + vs.get(i).getDisplayValue() + "\n");
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2018 03:20 PM
Perfect, small change with bold tag and thank you so much.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2020 09:50 AM
script displaying all the catalog variables in summary irrespective of mandatory and non mandatory (filling or not filling)variables.
can you please help me with the script if in case there is no data in variables to hide those variables in summary.
Thanks!!!