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
NM AdminNM Admin 

INVALID_MARKUP, Error while parsing Rich Text Content: Unsupported HTML tag or attribute encountered - Process_Event: [RawBody]"  when I enter <> and save the record.

Hi There,

Need help to overcome the below error:
I have a trigger on custom object in which when we create custom obejct record feed is getting created automatically and after the Feed insertion I am inserting same on the Custom object's parent's feed.

Scenario: When I insert the custom object I am getting error:
INVALID_MARKUP, Error while parsing Rich Text Content: Unsupported HTML tag or attribute encountered - Process_Event: [RawBody]"  when I enter <> and save the record.

This error takes me to the FeedItem's insert statement in trigger. As a solution
String tempBody = String.valueOf(fi.Body);
String tempFinalBody = tempBody.escapeHtml4();
 fRFA.Body = tempFinalBody;

I used the escapeHtml4() which allowing me to save the record and looks all fine.

But When I manually created FeedItem from custom object's feed and enter any value the Feed on the Parent record: <p> tag is getting added at the begining and </p> at the end of the FeedItem's post on after insert?


e.g. <p>Test</p>

What can be the reason behind this OR how can we achieve this?


Welcome to your suggetions!

Regards,
Nilesh
ANUTEJANUTEJ (Salesforce Developers) 
Hi Nilesh,

Can you try checking the below link as it has a similar error:

>> https://salesforce.stackexchange.com/questions/208679/how-to-escape-html-characters-in-long-text-area-field

>> infallibletechie.com/2015/01/escape-attribute-in-salesforce.html
Let me know if this helps and in case if this comes handy can you please choose this as best answer so that it can be used by others in the future.

Regards,
Anutej