Dev: Signatory Log Integration

Published on February 10, 2026 DRTE


Upload Signed Document from E-Signature Log Record

The uploadAndGetFileIdOFSignedDocument method (Upload Signed Document from E-Signature Log Record) is a global Invocable Action provided by the DRTE package. Call it from a Salesforce Flow after a signing process is completed to turn the signed document into a Salesforce File.

Quick Summary
Action name: Upload Signed Document from E-Signature Log Record
Apex method: uploadAndGetFileIdOFSignedDocument
Returns: the ID of the generated ContentVersion (File ID)

1. Overview

The method performs the following server-side operations:

  1. PDF Generation: Renders the finalized document (including signatures) using the internal DRTE PDF engine.
  2. File Creation: Generates a standard Salesforce ContentVersion (File).
  3. Automatic Linking: Attaches the generated File to the specified E-Signature Log record.
  4. ID Return: Returns the unique ID of the new File for use in subsequent Flow steps (e.g., sending an email with the attachment).

2. Input Parameters

When configuring the "Apex Action" in Flow, the following input variables are available:

ParameterAPI NameData TypeRequiredDescription
Record IDrecordIdTextYesThe Salesforce ID of the E-Signature Log record.
Envelope TokentokenTextYesThe unique security token/Envelope ID associated with the signing request.
File NamefileNameTextNoThe desired name for the PDF file (omit ".pdf"). Defaults to the Token value if left blank.
Footer TextfooterTextTextNoCustom text to appear in the footer of the generated PDF.
Header Image URLheaderImageURLTextNoA public URL for a logo to be rendered in the PDF header.

3. Output Values

ParameterData TypeDescription
Output ValueText (String)The ID of the generated ContentVersion record (The File ID).

4. How to Use in Salesforce Flow

Step 1: Trigger the Flow

Typically, this action is used in a Record-Triggered Flow on the pscdnyrichtext__ESignature_Log__c object when the Status changes to "Completed" or "Signed."

Step 2: Add the Apex Action

  1. In the Flow Builder, add a new Action element.
  2. Search for "Upload Signed Document from E-Signature Log Record".
  3. Map your variables:
Action InputValue to Map
Record ID{!$Record.Id}
Envelope Token{!$Record.pscdnyrichtext__Token__c}
File Name"Executed_Contract_{!$Record.Name}"

Step 3: Utilize the Output

Since the action returns the File ID, you can add a subsequent step to:

Success Criteria
After the Flow runs, the signed PDF appears under Files on the E-Signature Log record and the action returns a ContentVersion ID you can use in later Flow elements.

5. Technical Considerations & Security

PDF Rendering Context: This method uses Page.getContentAsPDF(). Please note that this is a callout-like operation. If you are calling this from a loop, ensure you stay within Salesforce governor limits for heap size and CPU time.
Atomic Operation: The file insertion and the link to the recordId happen in a single transaction. If the file creation fails, the transaction rolls back to maintain data integrity.

Knowledge Article Number: KA-00109

View more articles in the knowledge base