UI Action to Generate a Document Template (PDF)

Casey G
Tera Contributor

Hello, 

I have a Document Template (PDF) and I have it configured to a custom record type.  I want to create a UI Action to fire off the Document Template and generate the custom PDF and attach it to the record.  Is this possible?

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you might have to check the OOB implementation and enhance it based on your requirement

Regards
Ankur

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

Aman Kumar S
Kilo Patron

Hey,

I have done this for generating work notes as pdf and attach to the record, you can modify the body as per your requirement and use the same logic to generate.

var html = '<p>' + current.work_notes.getJournalEntry(-1) + '</p>';

var result = new sn_pdfgeneratorutils.PDFGenerationAPI().convertToPDF(html,'incident', current.getUniqueValue(), 'My First PDF');  //(body,tablename,sys_id of record you want to attach','name of the file') 

action.setRedirect(current);

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

Best Regards
Aman Kumar

I thought about using HTML however I have a very specific Invoice Layout I need to follow from my financial division.  I was hopping to leverage the Document Template PDF ability to take in a Form Fillable PDF and map it to my custom table.  Have you used Document Tables in this regard before?

Got it,

Sharing one article that does the same:

Filling PDF forms in ServiceNow

Best Regards
Aman Kumar