How to create Dynamic Subject of email client Template?

Community Alums
Not applicable

I want to set the subject of my email client template:-

I created an email script and used:-

email.setSubject('');

and called the email script with tag ${mail_script:'name od email script'} in the body of the template.

But the value of the subject is not populating.

Please help!!!!!

19 REPLIES 19

Allen Andreas
Administrator
Administrator

Hi,

Are you trying to set it to a specific field value from the form the email client is called from? Like...the incident short description?

Can you give an example of how dynamic we're talking here?

Here's a great blog about it and you can accomplish most of this without any script:

https://community.servicenow.com/community?id=community_blog&sys_id=df609af8dbbbdb405ed4a851ca961928

However, if you still wish to use mail script, then as sachin said, it needs to be called in body.

Please mark reply as Helpful/Correct, if applicable. Thanks!

 


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Community Alums
Not applicable

There is date and time field on form from which we need to extract only date and use it in email subject.

Can you post your email script code?

 

Regards,

Sachin

Hi,

Just to make sure, you're using:

${mail_script:name_of_email_script}

and not:

${mail_script:'name_of_email_script'}

So no ' ' in it.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi,

I just wanted to check in on this. If my reply helped guide you correctly, please mark it as Helpful & Correct.

Thank you!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!