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
Sankeerth ReddySankeerth Reddy 

Can I edit the TextBody of EmailMessage object when registering a case from Email-to-Case?


Can I write a 'after insert' trigger on EmailMessage object to edit the TextBody of incoming Mail?
Is it possible in Salesforce?
NagendraNagendra (Salesforce Developers) 
Hi Sankeerth,

The EmailMessage object permits the TextBody field to be updated

Triggers can certainly be written on EmailMessage including afterInsert triggers.

Note that some fields on EmailMessage can't be updated like Incoming and ParentId (the case it is associated to). See the doc

Hope this helps.

Kindly mark this as solved if it;s resolved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.

Sankeerth ReddySankeerth Reddy
Hi Nagendra,

I was not able to update the TextBody of EmailMessage through an after insert Trigger, but achieved it using before insert trigger.
Erick Hernández CerecedoErick Hernández Cerecedo
Sankeerth Reddy Como lo lograste?