Set the subject with a mail script on an email notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-01-2015 01:20 PM
What I am trying to do is set the subject of an email notification. There is a field in the subject that needs to be shortened via a script and then added.
I have created a Notification Email Script and have tried using template.print and email.setSubject to add my shortened field. I have tried putting the script in the subject field and also in the body of the message.
The email subject looks something like this:
RMA For: ${field1}-${field2}-${mail_script:shortenedEmailField}-${parent.location}
But when its being sent out I can still see the ${mail_script:shortenedEmailField} part in the subject.
Unfortunately the wiki is out of date again and is still referring to the older method of adding scripts to mail. <mail_script> email.setSubject('Email Subject'); </mail_script>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2015 12:02 AM
You can create a mailscript that you call in the body where you set the subject with:
email.subject = "MY NEW SUBJECT"
See also: Setting email subject with a mail script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2015 12:53 AM
Hi Steve,
I believe, you cannot call mail script into a subject.
You have to call mail script in a body to set subject through script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2015 12:57 AM
In the email script use this code to set the subject
email.setSubject("Your Subject").