How to display html field type data in UI Page without tags.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2023 12:24 AM
Hi,
I have a UI Page where I need some advice/help on how can we display the text from html field type.
Right now, when am trying to display the field value , it is coming as "html" with tags included.
field name : details
My code below:
HTML:
<div class="related-list">
<g:macro_invoke macro="sn_major_inc_mgmt_pir_report_related_list_table" table="cmdb_ci_outage" title="${gs.getMessage('Outages')}" query="JOINcmdb_ci_outage.sys_id=task_outage.outage!task=${jvar_sysparm_sys_id}" columns="cmdb_ci,type,message,begin,end,details"/>
</div>
UI Macro used here is a read-only OOTB one "pir_report_related_list_table".
output:
| Jira | Outage | Teams were unable to track, plan, report | 07/11/2022 14:43:03 | 07/11/2022 16:08:42 | <p><em>Update from Major Incident Management issued on </em>08/11/2022 18:13:53<em>.</em></p> <p><em>Description -</em>The Jira application was unavailable, or slow, when using URL https://jira.nbnco.net.au/. [https://jira.nbnco.net.au/.]</p> <p><em>Impact -</em>Teams were unable to track, plan, report and manage work or project tasks using the Jira application. Ongoing Jira application unavailability, or slowness, may have delayed the scheduled delivery of work and project tasks.</p> <p><em>Latest actions -</em>A successful monitoring period over the business day has occurred, with no slowness due to server resources after last night's rollback.</p> |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2023 12:33 AM
As details is HTML field it will give the html tags in it.
I would suggest to create a new field on outage table and move the details field value to new field without html tags.
Remove html tags like below
Script:
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2023 02:30 AM
Thanks @jaheerhattiwale .
May i ask, if there is any other way than to create a new field. Just for this report, i would be creating this new field, which i don't think is recommended. Also, saw some snow recommendation too, who suggested this same solution, but wanted to know if there is a way to parse this html field in UI page and use that as output ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2023 02:38 AM
@MithileshK Yes creating a new field only for this purpose is not good idea.
As you used ootb ui macro I suggested that.
But if you write a custom ui page then you can remove html tags in ui page itself.
Let me try to create custom ui page.
Btw where you want to show the output and how you are getting outage sys I'd?
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2023 02:37 AM
so you are invoking that UI macro but from where?
How are you passing the field value to that?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
