service portal text is displaying with html tag
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2018 02:06 AM
I have a field on record producer called 'Please describe your issue below'(HTML type) mapped to 'short description'(multi line text).
Am writing business rule to convert the HTML to normal text:
(function executeRule(current, previous /*null when async*/) {
var a=current.short_description.getXHTMLValue();
//to remove HTML characters.
a= a.replace(/&(lt|gt);/g, function (strMatch, p1){
return (p1 == "lt")? "<" : ">";
});
var b = a.replace(/<\/?[^>]+(>|$)/g, "");
//to remove &
var c=b.replace(/&/g, '&');
current.setDisplayValue('short_description',c);
})(current, previous);
----------------------------------------------------------------------------
Now in short description field of incident am able to see only text.... But not in service portal....
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2018 03:57 AM
Hello,
This won't fix you issue. But i would suggest actually putting the content into an html field. Or to change the field in the service portal to "string". That would simplyfy your development alot and i don't see any reason not to do either of these. Because writing a fully fletched html converter in Javascript can take alot.
Greetings
Fabian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2018 04:03 AM
HI Swathi,
check this link it may help you
https://community.servicenow.com/community?id=community_question&sys_id=e87f0725dbdcdbc01dcaf3231f9619ee