generate PDF with Purchase order details after clicking UI Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Friday
Hi,
I have a blank document and wanted to fill some fields from a record upon clicking some UI Action in ServiceNow form.
Please let me know if anyone has ideas or something how to generate a PDF with this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Friday
Here are some ideas:
- Make the UI Action open a link which has a specific view of the record - example
- Make the UI Action trigger a notification with the body precisely as you want it
- Make the UI Action trigger a report that exports as PDF
- Use the "Printer friendly version" in your profile menu from a specific view
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
Hi @R_52 ,
You can generate a PDF with selected fields from a ServiceNow record using a UI Action. ServiceNow supports this via out-of-the-box export options, the PDFGenerator API, or third-party store plugins. Here are common approaches:
Method 1: OOB Export to PDF
Use the built-in Export > PDF function from the form's context menu.
Only fields shown in your current form view will be captured.
To customize which fields are present, adjust the view or use a dedicated view for exporting.
Method 2: PDFGenerator API (Advanced/Custom)
From Quebec release onwards, ServiceNow includes a PDFGenerationAPI to fill fields on a PDF template:
// Example for UI Action Script
var pdfTemplateSysId = '<sys_id of template PDF>';
var tableName = current.getTableName();
var recordSysId = current.getUniqueValue();
var pdfName = 'Generated_Document';
// Map record fields to PDF template fields
var fieldMap = {
"company": current.company.getDisplayValue(),
"employee": current.assigned_to.getDisplayValue(),
"ci": current.category.getDisplayValue(),
// Add more fields here
};
// Call PDFGenerationAPI to fill and generate PDF
var pdfGen = new sn_pdfgeneratorutils.PDFGenerationAPI();
var result = pdfGen.fillDocumentFields(fieldMap, pdfTemplateSysId, tableName, recordSysId, pdfName);
gs.info(JSON.stringify(result, null, '\t'));
// This will attach the generated PDF to the record[web:66]
You need a fillable PDF template uploaded to your instance
You can run this script via a UI Action (Form Button)
The generated PDF is attached to the record (visible in the Attachments)
Method 3: Store Plugin (PDF Generator by Sofigate)
The PDF Generator app enables PDF generation from records via a form button.
This is a non-custom solution available from the ServiceNow Store.
Key Steps
Create/upload a fillable PDF template (with mapped field names).
Implement UI Action with PDFGenerationAPI for field mapping and generation.
On button click, script pulls field values from the current record, fills the template, and attaches the resulting PDF.
Notes
Choose PDFGenerationAPI for most flexible, scripted, field-level control.
Simple requirements may be met with form view export, but layout and fields are less customizable.
Third-party plugins offer additional features without custom coding.
Let ServiceNow support or your developer team know your template requirements—they’ll help set up the template and field mapping for your business scenario.
You may find below thread helpful:
- https://www.servicenow.com/docs/bundle/zurich-platform-administration/page/administer/exporting-data...
- https://store.servicenow.com/store/app/49ceebea1b646a50a85b16db234bcb21
- https://www.servicenow.com/community/itsm-articles/how-to-generate-pdf-from-ui-action/ta-p/2831049
- https://www.servicenow.com/community/itsm-articles/how-to-generate-pdf-from-ui-action/ta-p/2831049
- https://www.servicenow.com/community/developer-articles/fill-fields-in-a-pdf-using-quebec-api-quot-p...
If it is helpful, please hit the thumbs button please mark the answer as correct based on the impact!!
Kind Regards,
Shaik Mohammed Mustaq
