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
AichaSFAichaSF 

'HTML Body: data value too large' in EmailMessage - Solution

Hello,
I received this message by inserting an email in the EmailMessage subject.
User-added image
Have you found a solution to work around this problem. I tried to detect the event in a trigger before insert in the EmailMessage object, but no event is detected. Thank you in advance.
{tushar-sharma}{tushar-sharma}
We have character limits for every field, You need to make sure you didn't hit the limit.

https://developer.salesforce.com/docs/atlas.en-us.sfFieldRef.meta/sfFieldRef/salesforce_field_reference_EmailMessage.htm

You can try abbreviate to skip characters.
String s = 'Hello Maximillian';
String s2 = s.abbreviate(8);
System.assertEquals('Hello...', s2);
System.assertEquals(8, s2.length());

If this answer helps you, please mark it as accepted.

Regards,
Tushar Sharma
https://newstechnologystuff.com/