[SalesForce] Record an EmailMessage Status change on parent Case

EmailMessages have a Status field that will automatically update from 'New' to 'Read' when you open the email record from the Case.

I'd like to update a Case 'Email Status' field to make it easy to tell from a Case List View whether there's a new unread email on a case.

However, the change to the Email's status field doesn't fire workflows or triggers on the EmailMessage Object!

Anyone have a good solution to this? Best I can come up with is scheduled batch apex to just update all cases with their most recent emailmessage's status.. but given the frequency of cases and emails this would have to be running near constantly to be reliable.

Best Answer

Currently it is not possible to detect status change from New to Read. Here is an idea https://success.salesforce.com/ideaView?id=08730000000biKgAAI

Here is the workaround: Cannot get Workflow/Trigger to identify Read Email on Case object

An alternative to consider is to use a VF page as an element within your standard Case page layout.

  • The VF page is associated to a controller with access to the Case id
  • The controller can query the children of the Case (that is, EmailMessage)
  • The controller can thus display on the VF page a message indicating an unread EmailMessage (and links too)

Downsides?

If you need to use SFDC reports to report on Cases w/ unread emails (or List Views) - these won't work

Related Topic