- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2017 06:54 AM
Hello Community,
I'm doing some re-factoring on my email notifications and I've come across a scenario where I have 2 notifications on the same table(sc_task) for the same reason but with different recipients because the information is slightly different(1 or 2 lines difference). These 2 emails can use the same email script but there is 1 roadblock here. Is there a way for me to determine, in the email notification script, who the recipient of the notification is?
Ive tried using the email_action object but many of the properties inside are empty. Here is a small snippet of the properties i looked at...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2017 10:41 AM
Jim, great content and useful as expected. The method that you outlined in that post is a little more complicated than I need for my situation however, you brushed right over EXACTLY what I was looking for. Here...
The email_action object provides access to 3 properties to obtain the recipients of the email notification..
is accessed via email_action.getValue('recipient_fields') and correlates to this field on the email notification record
is accessed via email_action.getValue('recipient_groups') and correlates to this field on the email notification record
is accessed via email_action.getValue('recipient_users') and correlates to this field on the email notification record
That drawn out explanation was mainly for anyone else who finds this article but, I was not aware of I could access the properties of the email_action object that way because when logging it, those values are empty but when I use .getValue(), they actually return values. Anywho, that gives me what I need to continue my consolidation efforts. Thanks everyone for the assist here!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2017 07:06 AM
I don't know that the email's recipients are available to you. I would recommend checking the same conditions on "current" from the mail script that determine the recipients in the first place. That should give you the information you need.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2017 07:25 AM
Can you give me an example of what you're referring to? If you are referring to the same conditions that I am using to trigger the email notification, those are not available in the mail script using current as there is no reference of previous from the mail script, thus preventing me from checking if current.work_notes.changes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2017 07:41 AM
You are right... I don't think current.work_notes.changes() would be available in a mail script.
Is this an event-based notification or condition-based? If it's event, you could use a parameter (event.parm1 or event.parm2).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2017 07:53 AM
The vast majority of these are condition based. Its not the worst thing if I can't access the recipients, it would just be very beneficial in consolidating these mail scripts.