Background: I am trying to implement Email2Case as efficiently as possible for my company, and one of our current issues/gripes with it is that Salesforce has no native ability to parse only the "newest" portion of the message into a new reply. The result is that lengthy back-and-forths end up becoming very long, scrolling walls of text - cluttering page space and just impacting the experience.
Partial Solve: I'm able to solve this easily in automated response emails by adding a unique friendly string to the top of the templates, and then using
String.SubStringBefore() to only grab any new text that exists above my friendly string, but when users send emails from the native Send Email action on a Case there is no native option that I can find to add custom text to the email body.
Already Considering: I can add thread Id to the body natively through Settings, which I could then search for and stop on the first occurrence of, but this is messier because then I'd need two separate logic blocks to check for different "end of message" strings and handle them differently.
I'm not opposed to this, just trying to first explore the option of being able to add my EXISTING "friendly string" to all messages before they go out.
I thought I could just modify the String in the
before Insert context on the
EmailMessage object, but according to this: EmailMessage before insert trigger not working as expected? , it doesn't work like that.
Ultimate Question: Is there some way that I can programmatically "catch" an email message before its sent and modify the body to append a string?