Based on our ServiceNow development experience, there is a recurring need for the automated generation of custom PDF files from ServiceNow, with data coming from any ServiceNow record type, including incidents, catalogue items, HR cases, CSM cases, and so on. Our solution described in this blog post provides a simple and inexpensive way of generating custom PDF forms from ServiceNow with automatically populated data of selected fields from any ServiceNow record type. Our solution can generate PDFs from ServiceNow records using a UI action button on forms that, when used, will immediately start the download of a PDF file with the desired content. Or it can attach PDF files automatically to any of the selected email notifications in a ServiceNow instance, so that the recipients of those email notifications get the automatically populated PDF files as an attachment to the emails sent to them by the ServiceNow instance. The solution is easy to configure, so PDF templates can be uploaded, and PDF form fields can be mapped to any ServiceNow record type fields without any development skills.
This is how the solution looks like in our custom application in ServiceNow.
The first step is to create a new PDF template definition record with an attached PDF template that you would like to use.
Then the ServiceNow record type (for example incident, request, change, HR case, or CSM case) where the PDF form should populate its field values can be selected, and after that, with the Refresh fields all the fields from the PDF form will be listed automatically ready to be mapped with ServiceNow fields using field mapping or scripted mapping options. In effect, in case of any PDF export from that type of record, the PDF files will always use that mapping, and the PDFs can be created automatically from ServiceNow. The PDF record can be previewed using the Preview PDF document UI action link.
Then PDF generation can be linked to UI action buttons and to existing notifications on selected ServiceNow record types. The Preview UI Action Usage will help create the desired UI action on any ServiceNow record type where it is needed. When the UI action button is used on a ServiceNow form, a PDF file will be automatically generated with the desired content coming from that record.
A PDF template can simply be linked to any of the existing notifications in ServiceNow; when the notification emails from those record types are sent out from ServiceNow, they will automatically contain the PDF file populated with the data from the mapped fields.
Andras Ovari is a ServiceNow Architect with over 10 years of technology development experience. He has completed over 30 successful ServiceNow projects in multinational teams for customers from numerous EU countries.