Not show hidden variables in mail script notification

acf
Tera Contributor

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/>");
				}
			}
1 ACCEPTED SOLUTION

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

View solution in original post

5 REPLIES 5

acf
Tera Contributor

Hi Abhijit,

 

I tried this "isVisibleSummary" before and it doesnt work for me, only if I unchecked the "Visible on Summaries" in the variable