Display Notification name in email via email script

postwick
Giga Expert

I want to include the Notification name in outgoing emails, dynamically so I don't have to hard code it.

Is there a way to get at the Notification name with an email script?

1 ACCEPTED SOLUTION

edwin_munoz
Mega Guru

Hello Paul,



According to the documentation in the email scripts you have access to email_action which contains the GlideRecord for the email notification. Scripting for Email Notifications - ServiceNow Wiki



So it would be:



email_action.name


View solution in original post

5 REPLIES 5

edwin_munoz
Mega Guru

Hello Paul,



According to the documentation in the email scripts you have access to email_action which contains the GlideRecord for the email notification. Scripting for Email Notifications - ServiceNow Wiki



So it would be:



email_action.name


Thanks, that got me to this:



Setting Up Subscription Based Notifications - ServiceNow Wiki



You can add an Unsubscribe link to the bottom of any email body by pasting in the following text. Be sure to change the values in arrow brackets to suit your environment. For instructions on creating email messages, see Email Notifications and Email Templates.
<mail_script> template.print('<a href="' + gs.getProperty('glide.servlet.uri')   + 'unsubscribe.do?sysparm_notification=' + email_action.sys_id   + '"> Unsubscribe </a><br />\n'); </mail_script>

Steven Young
Tera Guru

Did you ever get this working? could you please post how this is used.  
i've been looking but the wiki doesn't really help,


Yes, it works with the exact code I put into my last comment.



email_action is the object that represents the Notification so you can use email_action.name or email_action.sys_id etc