How to create Dynamic Subject of email client Template?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2020 04:36 PM
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!!!!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2020 05:28 PM
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!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2020 03:44 AM
There is date and time field on form from which we need to extract only date and use it in email subject.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2020 07:47 AM
Can you post your email script code?
Regards,
Sachin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2020 07:58 AM
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!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2020 06:24 PM
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!