Need to hide hidden variables in approval emails
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-17-2018 11:46 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-17-2018 03:08 PM
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(...);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-17-2018 10:15 PM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-10-2019 09:43 AM
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 š
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-29-2020 05:51 AM
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