- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2025 10:58 AM
I'm workint with an UI Page that uses an UI Macro as template and I need to display the values from another table.
As the field has HTML type, I need to remove the html tags and show the attached images also.
I'm trying to use replace(/./g, '') but my code is not working.
Does someone knows how to do this?
Here's my code:
<div class="panel-body">
<h3>Test Instructions</h3>
<span uib-tooltip="$[jvar_test.getValue('u_test_instructions')].replace(/./g, '')" tooltip-placement="bottom-left" tooltip-append-to-body="true" class="test-description text-ellipsis">$[jvar_test.getValue('u_test_instructions')].replace(/./g, '');
</span>
</div>
Thank you!!
Ana
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2025 05:30 AM
Hi Seja, I was able to resolve it. Using no_escape
<div class="panel-body">
<h3>Test Instructions</h3>
<g:evaluate var="jvar_test_instructions">
var test_instructions = "$[jvar_test.getValue('u_test_instructions')]";
test_instructions;
</g:evaluate> <g2:no_escape>${jvar_test_instructions}</g2:no_escape> </div>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2025 05:31 AM - edited 03-31-2025 05:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2025 11:30 PM
Hi @AnaBeatrizA
can you try with replace(/\./g, ""); instead of replace(/./g, "");
or Use replace(/<[^>]*>/g, ''); instead of replace(/./g, '');
This will remove only HTML tags while keeping the text content.
Please mark helpful and solution accepted if it helps.
Thanks & Regards,
Sejal
Thanks & Regards
Sejal Chavan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2025 05:30 AM
Hi Seja, I was able to resolve it. Using no_escape
<div class="panel-body">
<h3>Test Instructions</h3>
<g:evaluate var="jvar_test_instructions">
var test_instructions = "$[jvar_test.getValue('u_test_instructions')]";
test_instructions;
</g:evaluate> <g2:no_escape>${jvar_test_instructions}</g2:no_escape> </div>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2025 11:46 PM - edited 03-30-2025 11:48 PM
Please share the complete script
what are you trying to render from field "u_test_instructions"?
Is that field HTML type?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2025 05:31 AM - edited 03-31-2025 05:32 AM
I was able to resolve it using no_escape.