Automate DocGen Packages

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 field.

  3. Create a workflow that specifies when to send the outbound message.

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

Note: You can automate DocGen Packages using Salesforce Flow. For more information refer to the Create a Salesforce Flow workflow section.

Create a Salesforce field

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. Navigate to a record on an object you want to use to generate documents and then select the View Fields link.

  2. On the Custom Fields & Relationships related list for the object you're working with, click New.

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

  4. Under Field Label, type Drawloop_Next.

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

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

  6. 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 objects 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 autodocusign

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

  7. 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. Under Setup click Create, Workflow & Approvals, and then Outbound Messages.

    You may have to click Continue on Understanding Workflow.

  2. On All Outbound Messages, click New Outbound Message.

  3. Under Object, select the object on which the DocGen Package you are trying to automate is based and click Next.

    For example, all the samples in this topic are based on the Opportunity object.

  4. On the outbound message configuration page, type a name under Name and Unique Name.

  5. Under User to send as, select a user.

  6. Under Endpoint URL, type 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. Complete the Setup of the Create a Salesforce field

  2. Complete Configuration of the Create a new outbound message.

  3. Navigate to Flows in Salesforce Setup.

  4. Click the New Flow button.

  5. Select Record-Triggered Flow option.

  6. Configure the Start Event Object, Trigger, and Conditions.

  7. Click Done.

  8. Add the Outbound Message Element. Click the + to add an element.

  9. In the Interaction menu click Select Action.

  10. Filter by Category using the Filter By field.

  11. Select outbound message.

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

  13. Provide a label for the outbound message.

  14. Click Done.

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