Print a form once its filled using a button

architmishra
Tera Contributor

Hi,
I want to print a form  (catalog item/order guide) after its filled/ submitted. A button should be configured and after clicking on it, the pdf should be downloaded with the details filled in the form. Also, can we achieve a custom pdf with customized looks and fields with specific details?
Thanks in advance!

1 REPLY 1

Mani A
Tera Guru

sample code:

 

var v = new sn_pdfgeneratorutils.PDFGenerationAPI;

//  (Option) get HTML from the short description field of an incident record
var gr = new GlideRecord("incident");
var html;
if (gr.get("sys_idof record")) {
 html = gr.short_description.toString();
}
var result = v.convertToPDF(html, "incident", gr.sys_id, "myPDF");
gs.info(JSON.stringify(result));
 
tested in background script and working fine.
 
Please check the doc for PDF API
 
 
 
mark my answer correct and helpful if it works for you