GlideXMLUtil.parseHTML() doesn't seem to work in scoped app.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2022 09:56 AM
I am trying to parse out the HTML from an HTML field to a text field. I created a business rule on a scope application based on this KB (https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0696694).
The background script works great (had to add a check for null)!
However, the business rule doesn't work. It seems that GlideXMLUtil.parseHTML() doesn't work in the scope app. Here is the code from the KB for business rule.
(function executeRule(current, previous /*null when async*/) { var html = current.text; //HTML field html = html.getHTMLValue(); var doc = GlideXMLUtil.parseHTML(html); var b = doc.getDocumentElement().getTextContent().trim(); current.u_plain_text = b; })(current, previous);
I don't see any warning or error in the logs.
Thank you in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2022 01:17 AM
Hi @mlee,
Try writing a global script include and calling it from within your script. Script includes should be defined to be accessible from all application scopes.
Please mark as Correct / Helpful if this solves your issue.
Regards,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 06:51 AM - edited 12-14-2022 06:51 AM
Thank you! I will give it a try and mark your solution appropriately.