Generating Output with the Render API

The Render API facilitates document generation from Docomotion forms directly within Salesforce, bypassing the Docomotion user interface. This guide covers the API’s capabilities, including method functionalities, parameters, and a select number of examples to illustrate use cases.

Docomotion Licensing and Render API Usage

A valid Docomotion license is required for each user generating documents via the Render API. Organizations with a Price Per Action (PPA) license can generate documents without individual user licenses, provided users have the Docomotion Generator permission set. Note: The absence of an error message if document generation fails due to licensing restrictions.

Contact Docomotion support for more licensing details or assistance.

Render API Overview

The Render API offers methods for creating document outputs in various formats and modes, accessible through Apex code within Salesforce where Docomotion is installed, prefixed with doco..

Key Methods

  • RenderCreateFile: Synchronously generates a document, ideal for immediate output requirements.
  • RenderCreateFileAsync: Asynchronously generates a document, suitable for background processing.
  • RenderBlob: Produces a BLOB of the document, typically for file downloads.
  • CreateLink: Generates a single signature object for document personalization.
  • CreateLinks: Generates multiple signature objects for bulk operations.
  • InsertLinks: Integrates signatures into the generated document.
  • MassGenerate: Facilitates bulk document generation asynchronously for multiple records.

Each method serves specific scenarios, from individual document generation to mass output production.

Mandatory Parameters:

  • formId: Identifier for the Docomotion form.
  • sobjectId: Salesforce ID of the main object.
  • mode: Output mode, such as FILE, ATTACHMENT, or EMAIL.
  • format: Output format, e.g., PDF, DOCX, HTML.

Additional parameters are listed here


Generates a document output synchronously.

Example: Generating a PDF attachment for a specific account record.

					doco.RenderAPI.renderCreateFile(596, '001j000000IzfyB', doco.RenderAPI.Mode.ATTACHMENT, doco.RenderAPI.Format.PDF); 


Facilitates document output generation asynchronously.

  • Usage Note: Especially useful in Apex Triggers or classes not requiring immediate response.


Creates a BLOB from the document output for scenarios like file downloads.

Example: Creating a BLOB for a PDF document to attach to a Salesforce record.

					Integer formId = 8;
Id sobjectId = '003WV000001FD2oYAG';
Blob newBlob = doco.RenderAPI.renderBlob(formId, sobjectId, doco.RenderAPI.Format.PDF);
System.debug('Blob value is: ' + newBlob);
Attachment attachmentPDF = new Attachment();
attachmentPdf.parentId = sobjectId; = 'testName' + '.pdf';
attachmentPdf.body = newBlob;//.toPDF(newBlob.toString());
insert attachmentPDF;


CreateLink & CreateLinks

Used to create signature objects that can be inserted into documents. createLink generates a single signature object, while createLinks is used for multiple signatures.

Usage Note: These methods are useful when dealing with documents requiring signatures.

Syntax Example:

					doco__Signature__c signature = doco.RenderAPI.createLink(formId, sobjectId, whoId, true, true);


This method is used to insert signatures, created by the createLink or createLinks methods (with toInsert = FALSE) or manually, into generated output.


  • signatures: A list of signature objects to be inserted.

Syntax Example:

					Boolean result = doco.RenderAPI.insertLinks(signatures); 


Enables asynchronous document generation for multiple records, supporting bulk operations.

Example: Generating PDF documents for a set of Account records and emailing them. 

					Set<Id> accountIds = new Set<Id>{'001...', '002...'}; doco.RenderAPI.massGenerate(formId, accountIds, doco.RenderAPI.Mode.EMAIL, doco.RenderAPI.Format.PDF, false);


  • formId
    • Type: Integer
    • Description: The Docomotion Id of the Form. (not the SF Id). Either formId or formName is required.
    • Mandatory.

  • formName
    • Type: String
    • Description: Name of the Form. Either formId or formName is required.

  • SobjectIds
    • Type: Set
    • Description: Set of the SF Ids of the Main Objects of the Form from which you want to generate output.
    • Mandatory.

  • aMode
    • Type: Mode (ENUM)
    • Description: The output channel we want to use to generate the output.See ENUM Mode.
    • Mandatory.

  • format
    • Type: Format (ENUM)
    • Description: The format of the generated output. See ENUM Format.
    • Mandatory

  • Combine
    • Type: Boolean
    • Description: Whether to combine outputs into one output or not. Note: Combing output is only supported for Mode.Document, and Format.PDF or Format.Html.

  • whoIdField
    • Type: String
    • Description: String that contains the field name to be used as a lookup for contact to which to send the email.

  • TemplateId
    • Type: Id
    • Description: Id of the email template to be used for sending generated output.

ENUMs: Mode and Format

The API uses Enums to specify output modes and formats, enhancing consistency and usability.

Mode Examples:

  • static doco.RenderAPI.Mode ATTACHMENT
  • static doco.RenderAPI.Mode CHATTER
  • static doco.RenderAPI.Mode DOCUMENT
  • static doco.RenderAPI.Mode EMAIL
  • static doco.RenderAPI.Mode EMAILBODY
  • static doco.RenderAPI.Mode.FILE
  • static doco.RenderAPI.Mode GOOGLE
  • static doco.RenderAPI.Mode LINK

Format Examples:

  • static doco.RenderAPI.Format BMP
  • static doco.RenderAPI.Format DOCX
  • static doco.RenderAPI.Format GIF
  • static doco.RenderAPI.Format HTML
  • static doco.RenderAPI.Format HTML4S
  • static doco.RenderAPI.Format JPEG
  • static doco.RenderAPI.Format PDF
  • static doco.RenderAPI.Format PNG
  • static doco.RenderAPI.Format TIF
  • static doco.RenderAPI.Format TXT