Convert HTML Type Field Value to String With Formatting Including Bullet Points and Alignment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2025 10:44 PM
Hi, is there any way to convert HTML type Field Values to a String, without loosing the Sentence alignment, bullet points inserted and convert it to string as it is.
There is a requirement where, i need to get the value of HTML field types and display them in PDF, So in that PDF i am getting multiple bullet points and not a desired format peresent in that value.
So If any one knows how to convert it to a string Value as it is, Please Let Me Know
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2025 10:47 PM
As per my knowledge, it’s not possible—you would lose the structure since the string is unformatted, whereas HTML contains formatting and tags.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2025 11:08 PM
Hello @Sai kumar123 ,
No need to convert the HTML value. The PDF generation API can directly work with the HTML value. Here is a basic example:
Here I'm having a Demand record with a Business case in HTML:
Here is how to convert that HTML into a PDF and attach it to the Demand:
var pdfUtil = new sn_pdfgeneratorutils.PDFGenerationAPI;
var gr = new GlideRecord('dmn_demand');
var html;
if (gr.get('number', 'DMND0001102')) {
html = gr.getValue('business_case');
}
var tableToAttach = 'dmn_demand',
sysIdToAttach = gr.getUniqueValue(),
pdfFileName = 'Business case for Demand';
pdfUtil.convertToPDF(html, tableToAttach, sysIdToAttach, pdfFileName);
This is the PDF that will be created:
Regards,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2025 04:16 AM
Hi Robert, thanks for your input, I had already implemented the usage of PDFGenerationUtils API, but some how when i am getting that value in backend, i mean i wrote a SI where i am using this PDF API , I am getting multiple bullet points , even though there is one Bullet point in HTML Field, I dont know why this is happening
anyway i try to see where it went wrong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2025 04:20 AM
Hello @Sai kumar123 ,
Thanks for the update. If you'd like to post that Script Include code here I can check why you are getting unexpected results.
Regards,
Robert

