How to get an approval notification to either not show rich labels or not show hidden variables

NicholeT
Tera Contributor

Hi All,

I'm trying to create a catalog item which has a number of rich text labels on it however these are showing in the approval email even when they are hidden via UI policy (even if the checkboxes are ticked to make them hidden in the RITM, REQ etc and not just on the catalog form).

Is there any way of using the standard approval email when the approval is requested by the flow, but not showing the Rich Text Labels, or even better, not showing variables at all that are hidden by UI policy?  Or do I have to write a custom notification for the approval which I trigger manually in the flow (an ugly way of doing it because I will have to stop the standard approval notification going out as well as creating the custom one).  Or am I missing something here?

5 REPLIES 5

@NicholeT 

you will have to use custom email script for this.

this sample script should help you, please enhance

(function runMailScript(current, template, email, email_action, event) {

	// Add your code here

	template.print('RITM 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();
		if(label != '' && value != ''){
			template.space(4);
			template.print('  ' + label + " = " + value + "<br/>");
		}
	} 

})(current, template, email, email_action, event);

If my response helped please mark it correct and close the thread so that it benefits future readers.

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