How to include variable editor variables in Email notification

Mrman
Tera Guru

Hi All,

I have configured the variable formatter and added a Section on HR case record to show the Record producer variables submitted by employee on to the HR case as shown below . 

Please help me with a requirement to include these variables under 'Case details submitted' section in the Email Notification sent to the employee when case is submitted .

I am not finding a way to call these variables in Notification , please guide.

find_real_file.png

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@ramamr 

You need to use email script for this

Name: show_variables

Script:

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

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

Then include it in the email notification like this

${mail_script:show_variables}

Regards
Ankur

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

View solution in original post

19 REPLIES 19

Hi @Ankur Bawiskar 

I want to make few variables readonly only in the Target record , not on the Record producer . 

On record producer everything are editable before submitting . Please suggest .

Sorry to bother you again,

Can you tell me if there is a way to Bold the Variable Label?

   

@Tom Thompson 

Can you post a new question for your query since the original question in this thread is already answered

You can tag me in that new post.

Regards
Ankur

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

Community Alums
Not applicable

Hi Ankur,

I have Used the Above mail script , But I didn't got the variable name data into email ,

Attached the screenshot as well, Can you help me to how to get the SCTASK variables editor variables into the email

 

Thanks

Kumar 

@Community Alums 

please post a new question and tag me there as this is an old question

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