- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2023 04:33 PM
Hi team community.
I'm trying to get html value on html_template fields. I can get for uncomments lines, but I would like to get comments lines as well.
Use case: Template field in sp_ng_template table contents this value:
<!--
<div class='blmWrapper'>
<div style='background-color:#fde11b;color:black;font-size: medium;padding:10px;margin:10px'>
-->
<p>I can get this text</p>
<!--The scheduled maintenance will now happen from 6:00 PM to 11:00 PM Pacific Time on 2/19, and there will be some slowness during this time. -->
so, if I want to get the value for the Template field, I just got "I can get this text", and I want to get all the text.
I tried using getValue(), getDisplayValue, and getHTMLValue(). None of them work. How could I retrieve all the text?
Thanks.
Claudio.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2023 12:47 AM - edited 04-18-2023 12:48 AM
Hi @Claudio6 ,
Where you are trying to get this value? I just ran a background script, and it fetched the commented values too. I think you are loosing the actual HTML markup while displaying it. May I know the use case, so that I can try to get some solution.
var gr = new GlideRecord('sp_ng_template');
gr.addQuery('id', 'cxs-result-pinned');
gr.query();
if(gr.next()){
gs.print(gr.getValue('template'));
}
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2023 12:47 AM - edited 04-18-2023 12:48 AM
Hi @Claudio6 ,
Where you are trying to get this value? I just ran a background script, and it fetched the commented values too. I think you are loosing the actual HTML markup while displaying it. May I know the use case, so that I can try to get some solution.
var gr = new GlideRecord('sp_ng_template');
gr.addQuery('id', 'cxs-result-pinned');
gr.query();
if(gr.next()){
gs.print(gr.getValue('template'));
}
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2023 07:26 AM
Hi Anvesh!
I was using Xplore for running the script, I tried on Script Background and it worked. Looks like Xplore don't support the Html values.
Thank you!