Gutenburg can be incorporated into Apex-driven document-generation workflows using the same core generation patterns represented by the managed Salesforce Flow actions: single-record generation, multi-record generation, and mapped generation across records.
Generation patterns
The corresponding Flow patterns are:
- Create PDFs for 1 record
- Create PDFs for multiple records
- Map PDFs to multiple records
Apex-driven implementations should preserve the same business concepts: identify the generation configuration, provide the applicable record context, and invoke the Gutenburg generation process.
Passing custom values
When Apex needs to supply a custom value to the template, define the variable in Apex and create a Gutenburg Input Field with the same name.
