PDF Preview before creation

zynsn
Tera Expert

Hi Devs,

 

Does anyone know how to create a UI action to preview a PDF before generating? I am going to use the command below to generate the PDF. However, I want to have a UI action to preview the PDF with the mapped fields before generating it.

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

 

https://www.servicenow.com/docs/bundle/xanadu-employee-service-management/page/product/human-resourc...

 

Thanks.

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@zynsn 

No you cannot preview it from background.

Did you try to use the preview function present on the document template?

But remember it won't fetch the data from the actual record and preview. It will just show the static data and not data coming from mapping fields

 

AnkurBawiskar_0-1737601462297.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@zynsn 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

zynsn
Tera Expert

@Ankur Bawiskar Yes, we do know about the preview function on the document template. I thought it would be nice to be able to preview the document with the data from the mapping fields before we generate the PDF.

@zynsn 

Unfortunately not possible.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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