- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2019 04:26 AM
Is possible to set custom values in Email Client Template in To field using script includes?
I already tried, and getting like current is undefined?
Solved! Go to Solution.
- Labels:
-
Notifications

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2019 04:32 AM
Greetings Milo,
The email client template system doesn't use the current.fieldname - instead it references the fields without current. This would seem to preclude the use of script includes that rely on using current object. Docs
-Andrew Barnes
Join me at Developer Blog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2019 06:41 AM
Hello,
That field will not trigger a javascript as far as I know.
What you do is:
- Create a Notification Email Script that first calls the Script Include
- Take the data received from the Script Include and in your email script and add it to CC (to add to "To:" field you need to have the address in the form, such as ${caller_id.email} for incident)
-
- In the script: email.addAddress('cc', addresses ) will add addresses to CC field
- In your Email Client Template, somewhere in the body (as it does not add any text to the email, it will not be visible in the finished, sent, email) add your email script using:
-
- ${mail_script:name_of_script}
You can try add your mail script in the To -field (as it does take ${caller_id} ), but I have not tried that myself.
I usually add addresses to BCC, as there is no real reason for everyone to know everyone else.
Read more here: https://docs.servicenow.com/bundle/london-servicenow-platform/page/script/server-scripting/reference/r_ExScptEmlNtfn.html
I hope this helps, and if so, please this as resolution to your ticket.
With regards
Anton
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2019 09:26 AM
Will it be processed on opening email client?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2019 11:24 PM
It should trigger on opening, but I can't remember at the moment if it does.