In notification emails, how do I call the email recipient user name in the email content

Madankumar N1
Tera Contributor

In notification emails, how do I call the email recipient user name in the email content

1 ACCEPTED SOLUTION

knight202
Kilo Guru

Place ${user_name} in the body of the notification or template.


View solution in original post

12 REPLIES 12

henry_cheng
ServiceNow Employee
ServiceNow Employee

Hi madankumar,



In an email notification the recipients are specified in the [Who will receive] table.


In your email notification you can write mail script and use current.xxx to quote the recipients. It depends on which field you want to send the email to.



Regards


Henry


knight202
Kilo Guru

Place ${user_name} in the body of the notification or template.


The SN Nerd
Giga Sage
Giga Sage

Answer: Depends.



If your recipients are a field, i.e. Assigned to


${assigned_to}



If your recipients are the event1 parm:


<mail_script>


var grUser = new GlideRecord('sys_user');


if( grUser.get(event.parm1) ) {


template.print(grUser.name);


}


</mail_script>



If your recipients are the event2 parm


<mail_script>


var grUser = new GlideRecord('sys_user');


if( grUser.get(event.parm2) ) {


template.print(grUser.name);


}


</mail_script>



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

find_real_file.png


how to get the values of watch list members values