How to make visible only SELECTED variables in the email notification (the ticket description)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 01:04 AM
Hi all,
How to make visible only SELECTED variables in the email notification (the ticket description)?
My screenshots:
S1 - I choose "Demographic data" in the form and then the field "Demographic Data Details (Please remove unnecessary information by clicking the green X)" appears. It's fine and only these two fields should be visible in the ticket description.
S2 - The ticket description shows every variable we have in the form (General Employee Data, Comp & Address) - we'd like to leave only yellow highlighted rows.
I'd really appreciate your help!
Many thanks,
Ania

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 01:24 AM
Hi @AnnaJu,
Can you share how you are now showing the variables, based on that we can help you better.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 11:51 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 11:58 PM - edited 09-19-2023 11:58 PM
Allright,
Then based on that script, this is a possible solution for you:
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
template.print('Variables: <br/>');
var variables = current.variables.getElements();
for (var i=0;i<variables.length;i++) {
var question = variables[i].getQuestion();
var label = question.getLabel();
var value = question.getDisplayValue();
var filled = value != false && value != 'false' && value != undefined && value != '';
if(label != '' && filled){
template.space(4);
template.print(' ' + label + " = " + value + "<br/>");
}
}
})(current, template, email, email_action, event);
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.