- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2017 10:35 AM
Hi All,
as I learned the hard way, just using mail scripts in the body (that will derive the proper from and reply_to values) will not work
But ok ... for the reply to I can use some easy js like "javascript:current.assignment_group" .... BUT how to go ahead with more complex script which I need to define the FROM field?????
PLEASE HELP.
Best would be to be able to add a email script .. but this does not work (tried like in the body with ${mail_script:abc_scipt_client}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2017 12:41 PM
You can write a script include and call the script include in the java script. in script include, you can include the validation of assignment group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2017 11:15 AM
does not work (maybe because of scoped app ... no idea).
I tried in the body:
${mail_script:csm_test_from}
and the mail script is set to:
(function runMailScript(current, template, email, email_action, event) {
email.setFrom("abc@xxxxx.com"); // valid email used
}) (current, template, email, email_action, event);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2017 11:18 AM
No. In the email body of client template, inside mail script tag, just type email.setFrom("abc@xxxxx.com"); . Don't use ${mail_script:
below is an example
<mail_script>
email.setFrom("abc@xxxxx.com");
var uname = current.user;
if (current.type != 'received') {
var u = new GlideRecord('sys_user');
uname = current.sys_created_by;
if (u.get('user_name', uname))
uname = u.name.toString() + '<' + u.email.toString() + '>';
}
var cdate = new Date();
cdate.setTime(current.sys_created_on.getGlideObject().getNumericValue());
var header = "On " + cdate.toLocaleString() + ", '" + uname + "' wrote:\n\n";
template.print(header);
if (current.body_text.isNil())
template.print(current.body);
else
template.print(current.body_text);
</mail_script>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2017 11:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2017 12:00 PM
I get you now
use this ${mail_script:csm_test_from} in body then
and can you post a screen of the notification script. why are you using (function runMailScript(current, template, email, email_action, event) {
You can just write email.setFrom("abc@xxxxx.com"); // valid email used
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2017 12:09 PM
I tried with the long mail script and it did NOT work.
So I want to know in general if a mail script can be used to set the FROM field ...
... here the mail_script
and here the template
and here the log ;-(
I assume if it normally should work - it again is some scoped app limitation ;-(