HTML code being returned when previewing the document template of type HTML

Veena-EeshB
Tera Contributor
HTML code being returned when previewing the document template of type HTML .I was testing the document generation through API script , but the pdf which got attached to the record shows with HTML tags .  i have used some plain single line text to print . And even when i click on preview on HTML document template , it shows the same .Can you please let me know what am I missing.
 
 
var recordId = '52fc****;
var documentTemplateId = '252a***';
var pdfName = 'INC_Template.pdf';
new sn_doc.GenerateDocumentAPI().generateDocumentForTask(recordId, documentTemplateId, pdfName);
2 REPLIES 2

Ehab Pilloor
Giga Sage

Hi @Veena-EeshB,

 

Have you added HTML code directly into the HTML canvas or via source code?

EhabPilloor_0-1793013794856.png

 

I have implemented a document creation and it works fine for template type as HTML template. I dont see any issues. I have created HTML code and built my document template. Your script is correct too.

Edit: assign the creation of template to a variable, not related to the issue but a good practice.

var result = new sn_doc.GenerateDocumentAPI().generateDocumentForTask(recordId, documentTemplateId, pdfName);

 

Regards,

Ehab Pilloor

Ankur Bawiskar
Tera Patron

@Veena-EeshB 

share your content within that template

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader