0

Scenario : I have case object. This case object has email related list. Case has contact and contact email address field. From email related list user will send email to contact associated with case. If the email is UNDELIVERED(Bounce back) then I need to send email to account team members associated with account in case.

What I have done so far,

1)

  • created one formula field(Mail bounced) to flag if undelivered using EmailBounceReason != null formula in case
  • Then created one workflow with criteria as if Mail bounced == true. Added a Email Alert action to send to account team members.

failed reason : formula field is updating after some time so it is not getting the value.

2)

  • Added another checkbox field in case. Am trying to update this field when email is undelivered from TRIGGER(after insert of EmailMessages). But I can't able to get the value of the formula field while querying because it is taking some time.

So that formula field is taking some time to update that causes the problem.

What will be the best approach to do this scenario?. Any help is appreciable. Thanks!.

0

What you are observing is that the database update engine that would trigger the DML event in order for your workflow to execute doesn't happen when emails bounce

Our friend @sfdcfox has identified this in his answer here

No, the email bounce system bypasses the record update engine entirely; it does not update any audit fields (e.g. last modified), does not fire any triggers, and does not send any emails or evaluate workflow rules. These are one of the few updates that occur in the system "off the grid." You won't be able to detect this event in realtime, so you'd probably just want to schedule a daily report to be emailed or something similar.

Hence, to workaround the issue will require a scheduled job that looks for Contacts with bounced emails since the last job , updates a custom Boolean field on Contact called hasUnprocessedBounce__c.

Then you can write workflows/flows to send email alerts; be sure to use a field update to switch to false the hasUnprocessedBounce__c once you've sent the emails.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.