Automate DocGen Packages

You can use a workflow and an outbound message to automate generating documents. There are three high-level steps:

  1. Create a field in Salesforce that includes references to all the fields a user would manually select to generate documents.

  2. Create an outbound message and bind it to the Salesforce field.

  3. Create a workflow using Salesforce Flow. For more information, see the Create a Salesforce Flow workflow to specify when to send the outbound message.

When the workflow criteria are met, the message is sent, automatically generating documents that create output and deliveries specified in the DocGen Package.

Create a Salesforce field

Note: For more information on creating custom fields in Salesforce, see Create a Custom Field. In this topic, all the examples are based on the Opportunity object.

Create a field in Salesforce that includes references to all the fields a user would manually select to generate documents.

To create a Salesforce field:

  1. In Salesforce, click Setup.

  2. Search for Object Manager in the Quick Find box.

  3. In Object Manager, search and select Opportunity.

  4. On the left pane, select Fields & Relationships and click New.

  5. Under Data Type, select Formula, and click Next.

  6. Type Drawloop_Next for Field Label.

    You must use Drawloop_Next under Field Label. If you need to create more than one field, append a number or another character, but always start the string in Field Label with Drawloop_Next.

  7. Under Formula Return Type, select Text and click Next.

  8. Type the formula using these guidelines (the formula is inserted by the Insert Field function built into Salesforce):

    • Append the letters SF to all object names.

    • Pass all relevant object IDs.

      You can find object IDs in the URL. For example, to find the Salesforce ID for a Delivery Option, navigate to the Delivery Option detail page and examine the URL.

    • Specify a DocGen Package ID and deployment type.

      Example: "SFobject_name__c:" & "ObjectId" & ";SFanother_object__c:" & "AnotherId" & ";DDPId:static Id;Deploy:staticid"

       
    • Some delivery options take the DeployType parameter. If you use a delivery option that takes DeployType, use this syntax: Deploy:StaticId: DeployType: Value

      Example: If you want to specify a Salesforce email Delivery Option, it would look like this: DeployType:autoemail; 

      Delivery Option Deploy Type
      Salesforce email autoemail
      SMTP

      autosmtp

      HTTP Service autohttpservice
      Document Queue documentqueue
      DocuSign (Legacy) autodocusign
      DocuSign (DAL) autodocusignal

      Note: If your DocGen Package contains images or reports, see If your DocGen Package contains images or a report.

  9. Click Next twice, and then click Save.

Create a new outbound message

After you create the Drawloop_Next formula field, you must add the field to an outbound message that can send all the necessary IDs to Nintex.

To create a new Outbound Message:

  1. In Salesforce Setup, search for Workflow Actions, then select Outbound Messages.

    You may have to click Continue on Understanding Workflow.

  2. Click New Outbound Message.

  3. Select an Object in the DocGen Package you want to automate, then click Next.

  4. To configure the outbound message, on Edit Outbound Message, insert a Name and Unique Name.

  5. Select a user for User to send as.

  6. For Endpoint URL, type in https://api.docgen.nintex.io/package/111.

  7. Select Send Session ID.

  8. From Available Fields, select Drawloop_Next and click Add. Drawloop_Next is the field you created. It should appear in Selected Fields with Id.

  9. Click Save.

Create a Salesforce Flow workflow

After you create an outbound message, you must create a workflow rule using Salesforce Flow. This workflow rule must be able to trigger an outbound message.

To create a Salesforce Flow rule:

  1. In Salesforce Setup, search for Process Automation and select Flows.

  2. Click New Flow.

  3. Select Record-Triggered Flow.

  4. To configure the flow, select an Object which you want to use.

  5. You can select when to trigger the flow in Configure Trigger and set the condition requirements for Set Entry Conditions.
  6. On the left page, add the Outbound Message element by clicking + Add Element and select Action.

  7. Filter by Category, and search for Outbound Message.

  8. Click Outbound Message, and select a record.

  9. Search the Action list for the desired outbound message record

  10. Insert a Label. The API name is automatically filled to match the label.

  11. Click Save and then click Activate to enable the Salesforce Flow.