How to store HTML code in string field?

Community Alums
Not applicable

Hi Team,

Work notes in incidents is updated through transform maps. And data comes in form of HTML. Work notes being journal field, it updates properly.

But this data is again sent to client system to store in string field.

But it is stored with HTML tags,

How to remove HTML tags and store in string field but with correct spaces(For example if table is present as a part of html, then it should format with proper spaces but remove tags and then store in string field)

 

 

2 REPLIES 2

Anurag Tripathi
Mega Patron
Mega Patron

Check the link below, should help

https://community.servicenow.com/community?id=community_question&sys_id=5f124fe9db98dbc01dcaf3231f961944&view_source=searchResult

-Anurag

Community Alums
Not applicable

Hi Anurag,

This is removing tags but not formatting data in proper way.

For example I want to show as below

find_real_file.png

But there are no proper spaces

find_real_file.png

Below is HTML code
[code] <p>Event Received: Indicates that the system is running out of the memory resources and the percentage of average free memory is below AverageFreeMemoryThreshold. -> HIRO previous one INC0120798 -> HIRO previous one INC0120798 - at 2018-11-26 19:19:52<br /> On device: cysbigdcdbmsq03 </p><p>Current memory usage: 99.72% </p> <p> The following processes were found consuming most of the memory: <br/><table style="width:100%">   <tr><th>ID</th><th>Name</th><th>RAM(MB)</th><th>StartTime</th></tr><tr><td>10100</td><td>dbbackex</td><td>541</td><td>11/26/2018 8:07:58 PM</td></tr><tr><td>1728</td><td>sqlservr</td><td>433</td><td>11/16/2018 7:07:36 PM</td></tr><tr><td>2156</td><td>dbbackex</td><td>271</td><td>11/26/2018 7:06:55 PM</td></tr><tr><td>5424</td><td>DTExec</td><td>210</td><td>11/26/2018 7:25:00 PM</td></tr><tr><td>7668</td><td>DTExec</td><td>203</td><td>11/26/2018 7:30:00 PM</td></tr></table> </p> [/code]
 
 
My main challenge is removing <table>,<tr>,<td> with proper spacing.