- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2014 09:08 AM
I am looking to determine if a business rule should run when an entry is added to sys_email
I currently have 2 criteria where if either is true, we should run the rule and possibly add an attachment.
- users email address
- The notification used starts with 3P
I have these as part of a Script Include that is called
Option 1 is easy and works
Option 2 looks fairly easy in that you get the sys_id of the email itself, look at the sys_email_log table, locate the entry where the email.sys_id is your email ID and the notification.name.toLowerCase().startsWith('3p')
This works fine calling the fine when run via a background script using an existing entry from sys_email.
I put it into the business rule (an on before) and no attachments were added, but I know the template does start with 3p so was a little bemused (the call to check the notification template indicates it is false)
I added an extra function to the include so that I can report on the name of the template from the sys_email_log table and that came back as 'undefined' which explains why I was getting a false return on the notification template.
(on checking against an existing entry, the correct name was displayed)
Of course, the sys_email_log is clearly added after the entry is added to the sys_email table and is why it is not there
SOOOO, is there a way I can determine from the sys_email entry what notification was used in its generation ?
Cheers
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2014 07:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2014 11:19 AM
Its there on the sys_email table itself, atleast till Berlin it was there, you could make out which Event fired.
You could find it on the bottom portion of the form view of the sys_email entry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2014 11:28 AM
Hi Subhajit
when I look at the sys_email entry, I do see the "Originating Event and Notification"
That is from the sys_email_log table, which is what looks like it is created once the sys_email entry has been created
I want to find the notification used before the entry is saved to the sys_email table
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2014 07:29 AM
I had a look at using the sysevent table too. I can see events in there, but again, I can run a background script and see the logic works well, however, when it is run as part of a business rule in the sys_email table it cannot find the entry
so unless anyone has any other ideas of how I can work out what notification has been triggered to work on the current sys_email object, I will have to revert to using a list of addresses / partial addresses.
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2014 07:42 AM
Nothing if I look at all the fields on the current record either.