Use Nintex DocGen with Process Builder and Flow Builder

Use this reference topic when using Nintex DocGen with Salesforce Process Builder and Flow Builder workflows. These workflows can be customized to automate document generation.

Nintex DocGen includes an Apex class for the Flow Apex Action that can also be used in both Salesforce Process Builder and Flow Builder, and a Preview Screen component for Flow Screens that can be used in Flow Builder workflows. For more information on how to use Process Builder and Flow Builder in Salesforce, see Salesforce Lightning Flow, or view the relevant Salesforce Trailhead modules.

Important: Each user who initiates Flow and Process Builder workflows must have a Nintex DocGen license as these workflows are triggered and run by the end-user.

Use Nintex DocGen with Process Builder

To generate documents with Salesforce Process Builder, use the RunDocGenPackage Apex Action in a Process Builder workflow.

Gather option IDs

Before you create your Process Builder workflow and Select and configure a RunDocGenPackage Apex Action, you'll need to gather the option IDs. These are configurable options for your DocGen run that determine the following:

  • Which DocGen Package to run
  • Which Delivery options to use
  • Which Record to run the DocGen package for
  • Which Account and/or contact record to use

These fields can be defined by the Salesforce Admin or Designer.

Gather the option IDs for the following options:

  • DocGen Package ID.
  • Delivery Option ID.
  • Record ID.
  • Contact ID (optional).
  • Attach ID (optional).

How to find option IDs.

The easiest way to find the option IDs listed above is to open the appropriate records and locate their IDs. Once the IDs are located, store the record IDs in a convenient place for future reference.

In the Lightning experience for in Nintex DocGen for Salesforce, click on the DocGen metadata panel to find the list of record IDs.

Select and configure a RunDocGenPackage Apex Action

To use the RunDocGenPackage Apex Action in a Process Builder workflow:

  1. Open Salesforce Process Builder from the Salesforce Setup, and create a new Process workflow.
  2. Click + Add Action under Immediate Actions, option  and set the following:
    • Action Type: Apex
    • Action Name: Run DocGen Package  (or any other descriptive name)
    • Apex Class: Run DocGen Package
  1. Complete the following required fields under Set Apex Variables:
Field Type

Value

Record ID Field Reference Click in Find the field. In the Select a Field window, set the Record ID of the object that you wish to generate documents for (e.g. Opportunity > Opportunity ID).  
Delivery Option ID ID Enter the Record ID of the Delivery Option from the DocGen Package you want to run. The record ID for the Delivery Option is located in the DocGen metadata panel.
DocGen Package Id ID Enter the record ID of the DocGen Package you want to run. 

Record IDs

 

Click + Add Row and enter your Record IDs in the field.

Important: Only one of the Record ID or Record IDs field can be used. If a value is provided for both, only Record ID will be used.

  1. Click Save > Activate > Confirm. Your process is now complete.

Use Nintex DocGen with Flow Builder

The following Flow Builder workflows are available to use with Nintex DocGen:

  • An Apex Action that can be selected to automatically generate and deliver documents (via a DocGen run) in the background once an event happens, for example, when a record is updated/created.
  • Since the DocGen Package is run in the background for this workflow, refrain from using the download delivery DocGen Package as there is no interface to retrieve the documents. Instead, use an Attach or DocQueue delivery option.

  • A Preview DocGen Screen component that displays the process of a DocGen run, and includes the option to allow end users to download the generated files via a link.

Gather option IDs

Before you select and configure a workflow with Flow Builder, you'll need to gather the following option IDs:

  • DocGen Package ID.
  • Delivery Option ID.
  • Record ID.
  • Contact ID (optional).
  • Attach ID (optional).

How to find option IDs

The easiest way to find the option IDs listed above is to open the appropriate records and locate their IDs. Once the IDs are located, store the record IDs in a convenient place for future reference.

In the Lightning experience for in Nintex DocGen for Salesforce, click on the DocGen metadata panel to find the list of record IDs.

Set the required options

  1. Open Salesforce Flow Builder from Salesforce Setup, create a new Flow, then deploy the Flow Screen Component for the page layout to your end-users. (The Preview DocGen screen is only available for screen flows.)
  1. Click the Manager tab > New Resource and configure the options listed in the table below. The API names in the table below are examples, but you can choose to use them if needed.

 

Preview DocGen screen component

Use the Preview DocGen screen component to display and generate documents in real time with the Delivery Options below that do not require user interaction.

Some Delivery Options listed in the table below are AutoSend only. Also, some eSignatures do not support Embedded Signing. See the table below for details.

Delivery Option AutoSend and other options
Download All
Attach All except Content- User Selected
Salesforce Email AutoSend only
SMTP AutoSend only
Adobe Sign AutoSend and no Embedded Signing
DocuSign AutoSend and no Signing Preview and Edit, or Embedded Signing
OneSpan Sign AutoSend and no Embedded Signing
Sertifi AutoSend and no Embedded Signing
SignNow AutoSend only
DocGen Queue All except Content- User Selected
Content Delivery Not allowed
Start Nintex Workflow AutoSend only

Drag Preview DocGen from the Screen Components Pane A DocGen Run that is starts from a user's action, implicitly started (such as changing a field), or a scheduled process. Also known as Auto Run. to the Screen Canvas The process by which a user performs an explicit action to trigger a DocGen Run., then set the following values for these fields required fields:

  • Type - (Custom): Preview DocGen
  • API Name - Enter, "previewDocGen" or any text you want to use for this field
  • DocGen Package ID - {!DocGenPackageID}
  • Record Id - {!RecordID}

The following fields are optional:

  • Contact Id - {!Send_To}
  • Attach Ids - {!AttachIds}
  • Success Message - Enter any text that you want to display once the documents are generated

Apex Action

To use the Apex Action to trigger and generate documents in the background without customer interaction, in the Apex Interaction (located in the Interaction section), search for and select RunDocGenPackage, then set the following values for these fields:

  • Label: RunDocGen (or any label you want to use)
  • API Name: This label is automatically entered, but you may change based on your needs
  • DocGen Package Id: {!DocGenPackageID}
  • Delivery Option Id: {!DeliveryOptionId }
  • Record Id: {!RecordID}
  • Record Ids: {!CollectionofRecords}
  • Contact Id: {!Send_To}
  • Attach Ids: {!AttachIds}

Important: Only one of the Record ID or Record IDs field can be used. If a value is provided for both, only Record ID will be used.

If you want to generate documents for a batch of records using the Record IDs field, you will need to use a Text Collection variable:

  1. Use the Query records action to get a Record Collection of record IDs (Record Collection is a specific type of collection).

  2. Convert the Record Collection into a Text Collection. In your Flow you will be able to Query for a Record Collection of IDs, you then need to use a Loop and Assignment variable to convert the list to a Text Collection:

    1. Create a Loop action that accepts the Record Collection, and extracts the Record ID to a Single Text Variable

    2. Create an Assignment action that adds the value of the Single Text Variable to a Text Collection Variable

    3. Create an Apex Action using the RunDocGenPackage Apex action that uses the Text Collection Variable in the Record IDs field.