I have a field which is currently of type Text Area (long) but has HTML tags in its content. I want to convert it to Rich Text Area but the no formatting is applied after conversion. Is there any work around for this?
-
4Rather than converting, it's better off creating a new Rich Text Area field and create a workflow that will push the data from the Long Text Area into the Rich Text Area - that way all the HTML content is applied as HTML and not plain text.– Boris BachovskiCommented Aug 22, 2013 at 7:18
-
After that, you can mass update the records either through the developers console or data loader etc.– Boris BachovskiCommented Aug 22, 2013 at 7:19
-
I've posted that as an answer too.– Boris BachovskiCommented Aug 26, 2013 at 4:57
3 Answers
The Workflow Field Update also loses the markup so best to stick to Apex Trigger solution
Small Logic to help with
String mailbdy=c.LongareaField__c;
String body=mailbdy.unescapeHtml4();
c.RichareaField_c=body;
Wouldn't you be able to:
- Create a new Rich Text field
- Pull down all your records with just the Id field and your Long Area Text field using Data Loader
- Use Data Loader to upload your file back onto the server to
Update
and map the old Long Area Text field into the new Rich Text field - Change the page layout to now use the new Rich Text field
This should take the long area text field and immediately map it into your Rich Text field without having to create any logic to handle that. It will also be completely unseen to your users.
Create a new Rich Text Area field and create a workflow that will push the data from the Long Text Area into the Rich Text Area - that way all the HTML content is applied as HTML and not plain text.
Once that is done, you can mass update the records either through the developers console or data loader etc.