- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2022 04:53 AM
I have this mail script to show variables in a approval notification, but this shows a checked hidden variables that i dont need it, how can I hide this variables in the notification?
Thanks!
template.print("<br/>");
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(current.sysapproval.toString());
set.load();
var vs = set.getFlatQuestions();
for (var i = 0; i < vs.size(); i++) {
if (vs.get(i).getLabel() != '' && vs.get(i).getDisplayValue()!='' && vs.get(i).getDisplayValue()!='false') {
template.space(2);
template.print(' <b>' + vs.get(i).getLabel() + "</b>: " + vs.get(i).getDisplayValue() + "<br/>");
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2022 06:42 AM
Then you would need to glide into Item Option table and filter out hidden fields. Please use below script,
template.print("<br/>");
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(current.sysapproval.toString());
set.load();
var vs = set.getFlatQuestions();
for (var i = 0; i < vs.size(); i++) {
var grOption=new GlideRecord("item_option_new");
if(grOption.get(vs.get(i).getId())){
if (grOption.hidden==false && vs.get(i).getLabel() != '' && vs.get(i).getDisplayValue()!='' && vs.get(i).getDisplayValue()!='false') {
template.space(2);
template.print(' <b>' + vs.get(i).getLabel() + "</b>: " + vs.get(i).getDisplayValue() + "<br/>");
}
}
Let me know if you have any further queries.
Please mark this as Correct or Helpful if it helps.
Thanks and Regards,
Abhijit
Regards,
Abhijit
ServiceNow MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2022 05:29 AM
Hi Abhijit,
I tried this "isVisibleSummary" before and it doesnt work for me, only if I unchecked the "Visible on Summaries" in the variable