I want to use the pdf document template to create a pdf where i want to pass the fields dynamically
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
I’m using GenerateDocumentAPI to create a PDF from a document template. The API requires a recordId from the template’s table (for example, a Case record) to map and fill merge fields.
My use case is different: I already have the values (from an integration) and don’t have or don’t want to use the Case record. Is there a way to pass a set of field/value pairs directly to the template and generate the PDF without providing a case record ID? If not, what’s the recommended approach?
Regards
Kaustubh Dubey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
The GenerateDocumentAPI in ServiceNow is designed to merge data from an existing record, so it requires a recordId to map fields. If you don’t have a record, the typical workaround is to create a temporary record in the relevant table, populate it with your field/value pairs, generate the PDF using that record, and then optionally delete the temporary record. This allows you to leverage the template without modifying its design while still providing dynamic data. There’s no built-in way to pass arbitrary field/value pairs directly without a record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @kaustubhdub ,
If you need a solution with a great deal of flexibility around PDF generation & data sources, Yansa Labs' PDF Generator offers quite a lot. It's a certified app on the ServiceNow Store. You can check the links below for more information. Feel free to reach out to Yansa Labs directly with any questions!
