Signature
global static void execute( List<GenerateDocumentBatch.FlowInput> inputs )
Parameters
| Parameter | Description | |
|---|---|---|
inputsList<GenerateDocumentBatch.FlowInput> |
required | One entry per document group. Each FlowInput carries the documents to generate and the optional signing settings for that group. See the field breakdown below. |
FlowInput
FlowInput
| Parameter | Description | |
|---|---|---|
inputsList<GenerateDocumentFlowInput> |
required | The documents to generate in this group. Each entry describes one document. |
signingSettingsGenerateDocumentSigningSettings |
optional | Combined-envelope signing options for this group. Leave empty for the default behavior (one envelope per document). |
GenerateDocumentFlowInput
GenerateDocumentFlowInput
| Parameter | Description | |
|---|---|---|
templateIdString |
required | Id of the CloudFiles template to render. |
documentTypeString |
required | Output document type, for example 'docx' or 'pdf'. |
recordIdString |
optional | Record Id the document is generated for. |
cloudFilesVariablesList<CloudFilesVariable> |
optional | Merge variables for the template, each a key and value. |
destination |
optional | Where the generated document is stored. |
params |
optional | Additional generation parameters such as PDF security and retention settings. |
GenerateDocumentSigningSettings
GenerateDocumentSigningSettings
| Parameter | Description | |
|---|---|---|
combineDocumentsBoolean |
optional | When true, all documents in this group are sent for signature together as one DocuSign envelope. Signers receive a single email and the signed documents are delivered together. |
emailSubjectString |
optional | Subject of the DocuSign envelope email. Defaults to the first document's template signing settings. |
emailMessageString |
optional | Message body of the DocuSign envelope email. Defaults to the first document's template signing settings. |
Return Type
void
Example
// Build one or more document inputs cldfs.GenerateDocumentFlowInput docInput = new cldfs.GenerateDocumentFlowInput(); docInput.templateId = '681b4169c697ffdc2aab2731'; docInput.documentType = 'pdf'; docInput.recordId = '003dL00000YsapJQAR'; docInput.destination = new cldfs.Resource( '68887db5ef0b3ca7534dbbd5', 'folder', null, 'cloudfiles', 'workspace' ); docInput.params = new cldfs.DocGenParams(); // Optional: send the whole group as one DocuSign envelope cldfs.GenerateDocumentSigningSettings signingSettings = new cldfs.GenerateDocumentSigningSettings(); signingSettings.combineDocuments = true; signingSettings.emailSubject = 'Please sign your documents'; cldfs.GenerateDocumentBatch.FlowInput input = new cldfs.GenerateDocumentBatch.FlowInput(); input.inputs = new List<cldfs.GenerateDocumentFlowInput>{ docInput }; input.signingSettings = signingSettings; cldfs.GenerateDocumentBatch.execute( new List<cldfs.GenerateDocumentBatch.FlowInput>{ input } );
Combined-envelope signing & Batch Apex support
Each processed input publishes a Document Generated event; if generation or signing fails, an Error Event is published for that input.
Set combineDocuments = true on the signing settings to send every document in the group as a single DocuSign envelope, so signers get one email and sign everything in one session and the signed documents are delivered together. Leave the signing settings empty to keep the default behavior of one envelope per document.
The action runs asynchronously and can be invoked from Batch Apex or other asynchronous (future / queueable) contexts.