Prevent empty fields in email notifications

SD29
Tera Expert

Hello Experts,

I have a request regarding email notifications. How can we prevent empty fields of a catalog item from appearing in the email notifications.

Thanks,

SD.

1 ACCEPTED SOLUTION

SD29
Tera Expert

if(vs.get(i).getLabel() != '' && vs.get(i) .getDisplayValue() != '' && vs.get(i) .getDisplayValue() != 'false'


View solution in original post

8 REPLIES 8

As far as i know there is no good way to get around with the check box type


SD29
Tera Expert

Ok Thanks


damodarreddyp
ServiceNow Employee
ServiceNow Employee

For ex:


var a = true;


gs.print(typeof a); >> boolean



something similar: check



var typ = typeof vs.get(i).getDisplayValue() ;



if you want to restrict all boolen fields in script / or you can add your own checks in if below --


if(vs.get(i).getLabel() != '' && typ != 'boolean') {


                    template.space(4);


                    template.print('         ' +   vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "\n");


              }


SD29
Tera Expert

if(vs.get(i).getLabel() != '' && vs.get(i) .getDisplayValue() != '' && vs.get(i) .getDisplayValue() != 'false'