Introduction
The CloudFiles: Generate Document (Batch) action allows you to automate the generation of multiple documents in a single action within Salesforce Flow Builder. It simplifies the process of handling multiple document generation requests, reducing complexity and increasing efficiency for bulk operations.
Unlike the Generate Document action, which processes a single document at a time, the batch action takes a collection of input configurations and generates multiple documents asynchronously, each based on its respective template and parameters.
Below is how the action looks like. Detailed descriptions of the input and output parameters are provided in the following section.

What this action does
The Generate Document (Batch) action processes a collection of document generation inputs in a single execution, where each input corresponds to a single document generation request. It automates bulk document creation with the same advanced features available in the standard Generate Document action.
Each variable in the collection input can specify a unique Generate Document action. Each processed input publishes a Document Generated event, which can be used to trigger additional automations or workflows.
Example Use Case:
A sales team needs to generate multiple Opportunity documents records in one go when the status is updated to 'Closed-Won'. Instead of using multiple Generate Document flow actions in the flow, a single Generate Document (Batch) action can be used to generate all the documents based on the input paramters.
Input Parameters
The Generate Document (Batch) action has two input parameters — one required and one optional:
Inputs
A collection of Apex-Defined Variables of the class cldfs__GenerateDocumentFlowInput.

Each cldfs__GenerateDocumentFlowInput represents the input configuration for generating one document and contains the same fields as the parameters for the Generate Document action:
- CloudFiles Variables: Runtime variables for template placeholders.
- Destination: Where to store the generated document (Salesforce or external storage).
- Document Type: Format of the generated document (pdf, docx, pptx, xlsx).
- Record Id: Salesforce record Id for pulling data.
- Parameters: Advanced security settings for PDF documents.
- Template: Template Id to be used for document generation.
- Create individual Apex-Defined Variables of the cldfs__GenerateDocumentFlowInput class for each document.
- Populate each variable's fields with the respective configuration values (e.g., template Id, destination, and record Id) as you do for a single Generate Document action.
- Add all these variables to a Collection Variable of the same class cldfs__GenerateDocumentFlowInput
- Input the Collection Variable into the action's Inputs parameter.
Signing Settings (optional)
The Signing Settings input is optional and is passed as an Apex-Defined Variable of the class cldfs__GenerateDocumentSigningSettings. Leave it empty and behavior is unchanged — one envelope per document.
It contains the following fields:
- combineDocuments (Boolean) — Flow label "Send all documents in a single envelope". When true, all documents generated from this input are sent for signature together as one DocuSign envelope: signers get a single email, sign everything in one session, and the signed documents are delivered together.
- emailSubject (String, optional) — Flow label "Envelope Email Subject (optional)". Subject of the envelope email; defaults to the first document's template signing settings.
- emailMessage (String, optional) — Flow label "Envelope Email Message (optional)". Message body of the envelope email; same default.
Create an Apex-Defined variable to hold the signing settings: set Resource Type to Variable, Data Type to Apex-Defined, and Apex Class to cldfs__GenerateDocumentSigningSettings (named signingSettings below).

Then, in an Assignment element, set its fields: combineDocuments to True to combine the batch, and optionally emailSubject and emailMessage for the envelope email.

Finally, pass the variable as the Signing Settings (optional) input on the CloudFiles: Generate Document (Batch) action.
When combineDocuments is true, every document in the input is bundled into one DocuSign envelope. The action runs asynchronously and can now be invoked from Batch Apex or other asynchronous (future / queueable) contexts.
A single combined envelope holds up to 25 documents and about 25 MB in total; split larger batches across multiple inputs. A signer who appears in more than one document of the same envelope signs them all in one step — their place in the overall signing order is preserved, but a per-document order for that signer is not.
Output Parameters
The CloudFiles: Generate Document (Batch) action operates asynchronously, meaning it does not provide immediate outputs after execution, instead publishes events for each processed input.
Document Generated Events
Each document generation request (individual input) publishes a Document Generated event upon successful processing. Use these events to trigger downstream automations or flows, such as notifications or additional processing.
Error Handling If an input fails to process, an Error Event is published for that specific input. These events can be used to identify and handle issues with individual document generation requests.