I created hidden variables on catalog form and those hidden variables are coming on the approval email. How can i remove those variables on the email.

Venkat141
Tera Contributor

I created hidden variables on catalog form and those hidden variables are coming on the approval email. How can i remove those variables on the email.

 

@Ankur Bawiskar 

@Saurav 

@shloke04 

@Anil Lande 

@Maik Skoddow 

@Jaspal Singh 

@Sandeep Dutta 

@Chandra Sekhar Maganty 

@Musab Rasheed

3 REPLIES 3

Community Alums
Not applicable

Hi @Pavan Ramireddy ,

It sounds like you are using a UI Policy or Client Script for that. If so you would likely have to add a condition to the attached script to exclude the variable however this solution would not be very maintainable if you had multiple catalog items with multiple variables that are to be hidden during email notifications.

var label = v.getGlideObject().getQuestion.getLabel();
var value = v.getDisplayValue();

if(label != '' && label != 'variable you want to hide' && value != '' && value != 'false'){
    template.print(...);
}

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you need to check value of that variable

if it's not empty then it means it is populated

can you share your script

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

shloke04
Kilo Patron

Hi @Pavan Ramireddy 

Your question is generic and without looking at what you have done till now is difficult to comment or propose solution to.

Generically speaking if you do not want empty variables in your Email then you can refer the solution provided in blog below from Amlan on the above query:

https://community.servicenow.com/community?id=community_blog&sys_id=ee8519acdb00bfc42be0a851ca961921

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke