How to set "Who will receive" through mail script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2014 11:13 PM
Hi Everyone,
I want to add "Who will receive' from <mail_script></mail_script>. is there any way by which we can set user/group filed in "Who will receive".
I m writing this code as below in <mail_script> in email template. But this is not working:
<mail_script>
var gr = new GlideRecord("change_request");
gr.addQuery("number", current.number);
gr.query();
if(gr.next())
{
var emailto=gr.requested_by.user_name+"@example.com";
email.setTo(emailto);
}
</mail_script>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2016 07:14 AM
Yes in email notification body.
You can pass user sys_id as well if you dont have email ids.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2016 07:25 AM
YUp it worked, but one question is we cannot have bcc or cc without to right ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2016 06:50 AM
Hi Ravali,
Could you please share a screenshot from the notification body where exactly you have written the mail script in Geneva. Also if you could provide script to cc users manager would be great.
Regards
Adarsh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2016 08:22 AM
Here is the email notification body:
Short description: ${short_description}
${mail_script: your mail script name}
In the email script, you can use:
(function runMailScript(current, template, email, email_action, event) {
if (!current.caller_id.nil()) {
var id = current.caller_id;
var user = new GlideRecord("sys_user");
if(user.get(id))
{
if(user.manager != '')
{
email.addAddress("cc", user.manager.email, user.manager.getDisplayValue());
}
}
}
})(current, template, email, email_action, event);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2017 06:41 AM
On Istanbul, the "Event parm 1 contains recipient" is missing. Is this still supported. My notification is fired on an event.
Am I missing something?
Thanks,
Jay