Email Notification dynamic subject

xiaix
Tera Guru

I found this:   Dynamic subject in an Email notification

But no answer.

I'm trying to call a mail script because I need a dynamic subject line:

find_real_file.png

However, when the email comes in, I get this as my subject line:   ${mail_script:dynamic_subject}

Is a dynamic subject line possible?

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

Hi David,



Call the dynamic_subject script from within the message body.



It should contain a line like this:



email.setSubject("This is the new subject line"); 


Scripting for Email Notifications - ServiceNow Wiki


Email Notifications - ServiceNow Wiki



View solution in original post

7 REPLIES 7

Chuck Tomasi
Tera Patron

Hi David,



Call the dynamic_subject script from within the message body.



It should contain a line like this:



email.setSubject("This is the new subject line"); 


Scripting for Email Notifications - ServiceNow Wiki


Email Notifications - ServiceNow Wiki



Genius.  


Hey Chuck,


the email.subject will be in the <mail_script> tags in the body of the email. But then system will ask you to convert in into a notification script, can we call one notification script in another email notification script?


HI Ravali,



You cannot call one notification script from another one. If you want to centralize your code, consider using a script include and call that from the various mail scripts.



Script includes