function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
tlo300tlo300 

Triggers won't fire

Hi,

 

I'm currently trying to calculate the time between an incoming email for a Case and the time the Caseowner responds to this email. When a user answers an email the EmailMessage trigger I wrote fires like it should. Problem is the trigger doesn't fire when an email comes in.

 

Another problem I have is that the triggers you write for a Case only fire when you actually change something on a Case or create a Case by hand. They don't fire when a Case is created by Email-to-Case. This seems to be a similar problem.

 

To solve this I tried writing a InboundEmailService class. This seems to work. Problem here is that it generates some email address it listens to. If I'm going to use this I want this service listening to the same incoming address as my email-to-case settings but I have not been able to get this to work as this email to Case also adds a new address.

 

Any suggestions on how I could solve these problems?

LakshmanLakshman

Hi

 

About your first problem I would suggest that you should check the Incoming flag of EmailMessage with boolean value true. If its true then only do your activities.

 

Also you need to write or add trigger on standard object EmailMessage object for second problem, I think this will help for your second problem.

 

Regards

Lakshman