setReplyTo not working mail in script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2016 07:43 PM
Hi all,
I've created a notification that's triggered on insert of a record to sc_req_item and I've used a Notificaion Email Script to add recipients using the email.setReplyTo function but the notification is not triggering. The notification record itself is OK I think because if I add recipients in the 'Who will receive' tab the notification is triggered. But, I can't use that because I need to get the recipients from variables in a catalog item.
Here's the mail script:
email.setReplyTo('john@example.com');
email.setReplyTo('roger@example.com');
email.setReplyTo('johnston@example.com');
email.setReplyTo(current.variables.requestor_email);
email.setReplyTo(current.variables.authorised_by_email);
The script is not working. Any ideas anyone?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2016 08:15 PM
I'll give the addAddress a go.
Thanks for the suggestion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2016 08:20 PM
Does it matter if I don't use the displayName?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2016 08:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2016 08:37 PM
Chuck,
Here' the objective
A notification needs to be triggered on insert of a record in sc_req_item.
I have two sets of recipients: three addresses that I can hard code into a mail script and two further addresses that need to come from variables in the catalog item.
The mail scrfipt so far looks like this (not taking into account suggestions made here so far):
email.setReplyTo('example@example.com');
email.setReplyTo('example1@example1.com');
email.setReplyTo('example2@example2.com');
email.setReplyTo(current.variables.requestor_email);
email.setReplyTo(current.variables.authorised_by_email);
I've tried using the addAddress method for one of the hard coded addresses and it didn't work. Also, I'm not sure if I could call in the catalog variables using that method.
Any help with this is much appreciated. It's turning out to be much harder than anticipated for something I would have thought was quite simple.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2016 08:01 PM
Hi Jim,
Try creating email scrip to specify 'Reply to' and then call this email script in you notification
Creating email script:
Script Name - sampleEmailScript
(function runMailScript(current, template, email, email_action, event) {
email.setFrom(abc@xyz.com);
email.setReplyTo(abc@xyz.com);
})(current, template, email, email_action, event);
Calling email script in you notification(add this in the message section of your notification or template):
${mail_script:sampleEmailScript}
P.S: Hit Correct answer/like/helpful as applicable