Stripping HTML from a record producer variable to field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2015 09:20 AM
Hi all,
We had an enhancement come in to include an HTML variable for our ESS Incident record producer for the detailed description so that clients can embed images for Service Desk to initially assess. We are not planning to change the field on the actual form to HTML as it will mess up thousands of previous records, so we left it blank and the Service Desk needs to manually copy and paste the variable's content into the field. We had tried directly moving it the normal way, but there were a ton of HTML tags.
Is there any way that something can be applied that will automatically strip all of the HTML and populate the description with just the text? We tried to do it but couldn't find a solution.
Any insight would be great if someone has done this before!
Thank you,
Amandah
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2015 12:04 PM
BTW: Adding the HTML field to an incident will allow your users to upload images. If you're not careful, they can upload images to the same table used for UI images, etc. It is also possible for a user to overwrite existing images and cause alot of confusion about which image should display. I documented my quest for a solution to this problem at the following link:
Need advice: Is it a good idea to include an HTML field in an incident record?
You can take it for what's it's worth. Good luck!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2015 12:47 PM
Hi Steve,
Thank you, this might be something worth investigating, though I want to avoid HTML fields because the reporting will look messy (it shows HTML tags). In our case, we weren't looking to convert the field into HTML, we just want to find a way to move the data from the HTML field over to the non-HTML field without tags but with carriage returns intact.
Have you had any experience with this, or know any steps to do this? The stripping of HTML seems easy enough, but we want to avoid a single line of text.
Amandah
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2015 01:10 PM
I like Pradeep's solution for removing the tags. But trying to preserve the newlines is like running up the "down" escalator.
Pradeep's solution would preserve any newlines in the text which are outside of the markup tags.
So I presume that you are concerned with the newlines created when the HTML is interpreted for display.
The problem with preserving those new lines is that so many HTML tags could result in a newline.
One approach would employ text substitutions to change all the pertinent tags to newlines, before running Predeep's solution to remove the remaining tags. But that list will change over time.
Some of the candidates that I know about are: <br> <p> <li> <tr>
But I'm sure that's not a complete list. And it ignores the fact that <li> can be displayed as a number if it is used in an ordered list.
See what I mean about the running up the down escalator?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2015 01:19 PM
I completely understand what you mean - I was hoping that there would be some easy way to do it, but it's definitely looking super complicated. Thanks for your help!