UI Action to generate PDF

srujancherr
Tera Contributor

Hi,

I installed Document Template plugin and added my own HTML Template, I can preview from Document template template form, but I want same capability to preview and download the pdf from Incident table, can anyone help me on this.

5 REPLIES 5

aakankshapl
Tera Guru
Hello  @srujancherr,
 
Please reffer below link
How to create pdf by using UI action button for incident record and same pdf attached to same record

If my answer has helped with your question, please mark my answer as an accepted solution and give a thumbs up.

Regards,

Aakanksha

 

Ankur Bawiskar
Tera Patron

@srujancherr 

you can have logic to generate the PDF but preview is something which you will have to check for heavy customization on particular table.

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

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

@srujancherr 

are you able to add preview logic?

if yes then please share that so that it helps other members as well.

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

Hi @Ankur Bawiskar ,

 

I couldn't get preview logic, but when i click on UI Action, using the html template i got apdf file attached to attachments,

here is the code,

var recordId = current.sys_id.toString();
var documentTemplateId = 'b473cc60838aaa10fba8c4e0deaad323';
var pdfName = current.number;
new sn_doc.GenerateDocumentAPI().generateDocumentForTask(recordId, documentTemplateId, pdfName);
action.setRedirectURL(current);
 
 
I need in word(Docx), can anyone help me on this