Need to hide hidden variables in approval emails

aamir1
Mega Expert

Hi All,

I am stuck at a point where I am not able to handle one situation.

There is a variable in an item which is hidden in some scenarios, but when approval emails trigger, it also includes that variable. But it should not be there in the mail. Attached is the code

5 REPLIES 5

Joel Millwood2
Kilo Guru

H aamir,

The script in question is iterating through all the variables relating to the Requested Item. How are you hiding the variable under certain scenarios? 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(...);
}

Hi Joel,

 

I am using it in an email script, which is being used in an approval email. The idea is to include the variables that are filled by the user in that mail.

 

My code is working fine and it does include the filled variables in the mail. But the issue is, the variable that I need to hide is mandatory and have a default value, hence I suspect, it is included in the mail.

But in catalog form, we are hiding this variable when selecting a particular choice from a dropdown and hence it should not have been there in the mail.

Please help how can I hide such variables in the email.

John Freeman1
Giga Contributor

Hey Aamir,

Did the reply from Joel fix your issue, or did you find an alternative solution?

I am having the same problem where I would like to hide variables in a notification when a catalog UI script has hidden them in the request/catalog item.

Thanks in advance šŸ™‚

Stefan K_
Tera Expert

I don't think there is smart way to manage this today. I wrote an idea for it, please vote it up: 

Catalog items>>Variable answers>>Store info if variable was visible or hidden during submit