The Now Platform® Washington DC release is live. Watch now!
‎05-09-2018 09:56 PM
Hi,
For a requirement, we changed the field type of Description from String to html and used for few days. But now we decided to change it back to String type.
The problem here is when we changed back to String, we see some tags in the existing record of incident, change, ritm and other task tables description(populated when the field type was html) field. Please help to resolve this.
Thanks in advance.
-Deepa
Solved! Go to Solution.
‎05-10-2018 12:02 AM
Below code converts HTML string to a text string. You need to run this code for subset of records and update the text string into that field
var gr = new GlideRecord('task');
gr.get('sys_id');
var htmlDesc = gr.description.getDisplayValue();
var txtDesc = htmlDesc.replace(/<(?:.|\n)*?>/gm, '');
gs.print(txtDesc);
‎05-10-2018 12:02 AM
Below code converts HTML string to a text string. You need to run this code for subset of records and update the text string into that field
var gr = new GlideRecord('task');
gr.get('sys_id');
var htmlDesc = gr.description.getDisplayValue();
var txtDesc = htmlDesc.replace(/<(?:.|\n)*?>/gm, '');
gs.print(txtDesc);
‎05-14-2018 11:59 PM
Hi Gurpreet,
It worked, thank you :-).
Is there a way to convert plain text to html?
- Deepa
‎05-15-2018 11:45 PM
There's no such thing as there could be many possibilities of applying HTML to a plain text field...
‎05-16-2018 12:42 AM
Thank you.