You need to sign in to do that
Don't have an account?
Valentin M
How are EmailMessage linked to the object from which they are sent ?
Hi all,
I'm working on some email integration stuff. I need to perform actions on the related object when an email is sent from Salesforce.
I understood that when you send an email from salesforce interface, it creates an EmailMessage record. So I defined a trigger on EmailMessage's "after insert" events but I can't figure out how EmailMessage records are linked to the SObject records they are related to. This link should exist since you can see the emails that were sent on the record's page but I already checked a few fields such as RelatedTo and ParentId fields, none of them contain the Id of the record they are associated to...
Thanks for your help
I'm working on some email integration stuff. I need to perform actions on the related object when an email is sent from Salesforce.
I understood that when you send an email from salesforce interface, it creates an EmailMessage record. So I defined a trigger on EmailMessage's "after insert" events but I can't figure out how EmailMessage records are linked to the SObject records they are related to. This link should exist since you can see the emails that were sent on the record's page but I already checked a few fields such as RelatedTo and ParentId fields, none of them contain the Id of the record they are associated to...
Thanks for your help
ParentId, hosting the Case ID
ActivityId, hosting the Task Id
ReplyToEmailMessageId, referencing a previous email message
You should probably check the field value of ActivityId in your context
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_emailmessagerelation.htm