0

I am attempting to create a custom formula field on the Case Object, which brings over the To Address field from the Email Message Object. However, when a new Case is created from Email-To-Case, the custom formula field on the Case Object is not populated with the To Address field from the Email Message Object (which is populated).

Any ideas as to why the custom formula field on the Case isn't populating?

Here is the Screenshot of the custom formula field on the Case

0

Formula fields are calculated on demand, and thus does not participate in the order of execution. In practice, that means it calculated each time it is queried from the database.

In the context of a DML operation, each formula is recalculated while loading Trigger.old and Trigger.new, before evaluating validation, assignment, escalation, and workflow rules, and while executing process builder, flow, and approval processes.

Formula Field calculation in Order of execution

Email-to-Case first takes the incoming email and performs a database save on the Case object. At this point in time, there is no Email Message record saved to the database. The Email Message gets saved later in the process, meaning that the Case Source field is not populated at this time with the Email Message which initiated the case creation. Therefore, when workflow rules fire (and auto response) during the save of the Case record, it cannot find any related Email Message record and so will evaluate to false and move on to the next criteria.

Email Message fields not evaluated by Case auto-response Rules

My guess is even though it doesn't explicitly mention about the formula fields even those are effected by the email2case behavior as formula fields are calculated ahead of workflow rules and there is no Email Message record saved to the database at that point of time

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.