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
Juan BlancoJuan Blanco 

Copy HTML content from Apex into a Rich Text Field removing unsupported tags

Hi all.

We want to copy certain HTML content (how we obtain that is not relevant for the question) into a field of type Rich Text Area (through a Apex code). Things "mostly" work, but the problem is that the Rich Text Area field does not accept/support all HTML tags, so those not supported appear as plain text. Is there an "automated" way, from Apex code, to remove the unsupported tags from the HTML? This would have to be some help class of some sort built directly by Salesforce I imagine, although the reason I am asking is because that code already exists "out there": it is exactly what happens in the UI if you copy HTML from somewhere and paste it into a Rich Text Area.

Thanks in advance for any insights on this.