“Error while parsing Rich Text Content: Unsupported HTML tag or attribute encountered” Exception in Salesforce

“Error while parsing Rich Text Content: Unsupported HTML tag or attribute encountered” Exception in Salesforce

Exception “Insert failed. First exception on row 0; first error: INVALID_MARKUP, Error while parsing Rich Text Content: Unsupported HTML tag or attribute encountered – span: [RawBody]” is thrown if the FeedItem body contains unsupported HTML Markups.

Check the following example with span HTML tag which is not supported. So, if you try to insert FeedItem with Body having span tag and IsRichText is set to true, then it will throw the exception.

Sample Code to reproduce the issue:

insert new FeedItem(
IsRichText = true,
Body = 'testing'
);

Exception will be “System.DmlException: Insert failed. First exception on row 0; first error: INVALID_MARKUP, Error while parsing Rich Text Content: Unsupported HTML tag or attribute encountered – span: [RawBody]”.

Check the following article for supported articles
https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_feeditem.htm#isRichTextDes

Leave a Reply