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
Dan Dodd 3Dan Dodd 3 

How to change the incoming emails "From" "before update" trigger

We receive emails from a third party system that sends emails under its own name with the body contining the actual email address of the case opener.

When we receive this email-to-case, the before update trigger is successfully capturing the email body and parsing off the email address.

But when the case is replieed to via email the "To" address is the third party systems address.

I updated the SuppliedEmail field but that doesn't fix it

Where does the "From Address"  get set in email to case so that it can be used to reply to the case opner??

The
Dan Dodd 3Dan Dodd 3
The case has a SourceId for the EmailMessage object.
If I  modify the EmailMessage.FromName and FromAddress will that do it?
Can I do this in the case before insert trigger or after insert?
David Zhu 🔥David Zhu 🔥
When you reply email from Case record, "To" Address is the Case's contact's email. I think when the contact is created, the thrid party's system email is used.
Dan Dodd 3Dan Dodd 3
In one case where the contact is established ( not Created but exists) , the "To" address of case email is still the thrid party system address.
Is there a way to tell when the "To" field id pulling from? 
  
David Zhu 🔥David Zhu 🔥
I dont' think it is configurable with standard Salesforce function.