How to make visible only SELECTED variables in the email notification (the ticket description)?

AnnaJu
Tera Contributor

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

3 REPLIES 3

Peter Bodelier
Giga Sage

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.

Tom Thompson
Tera Expert

Here is what we did to make emails work.

 

Show Variables in email  

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.