Documill Dynamo

Setting up Agentforce with Documill

This documentation only applies to the package version 2.1. If you are using an older version, please update it before proceeding.

Overview

Documill integrates with Salesforce Agentforce to enable AI agents to automatically generate documents as part of automated workflows. Agents can trigger document generation through a Salesforce Flow using an Apex action, API action, or Flow interaction, which then calls the Documill API to produce the output. For scenarios requiring more programmatic control, the Documill API can alternatively be invoked directly via an Apex class.

image-20260527-115649.png


Prerequisites

  1. Install the Documill document generation package from AppExchange.
    https://appexchange.salesforce.com/appxListingDetail?listingId=a0N30000009whyxEAA
    Detailed instructions can be found here.

  2. Install the Agentforce connector package from AppExchange.
    https://appexchange.salesforce.com/appxListingDetail?listingId=efb6d55a-fe5b-48cf-b256-e168d8300b58

  3. Set-up your Salesforce OAuth 2.0 client credentials flow.
    No-code API setup for Salesforce Flows
    This step is required to properly communicate with external apps based on Salesforces' security requirements.


  1. A Documill API Template
    How to create an API template: Create or change an API template
    Sample template: Quote Sample.dap

    If using the Sample template, download the file above and upload it into your Salesforce instance.


Permissions

To generate documents with Documill, you will need to assign the appropriate Documill permission set to the user who has been declared in step 3 of the pre-requisites.
https://support.documill.com/dynamo/user-permission-sets

Documill uses Salesforce to handle all permissions. Any user generating the document, will need to have at least read permissions on the template file and any objects and records used within the document.


Configure the Flow

The package comes with an overridable Flow. As the Flow requires the Salesforce OAuth 2.0 client credentials flow before being used, it will need some minor modifications before the agent can use it.

From the Salesforce Setup, navigate to “Flows”

{9CF545D2-3631-4EFA-BED9-04ABC7039BE2}-20260508-115554.png


Find the packaged “OpportunityAgentDocument” flow and click on it to edit.

{1C383B8A-608F-4E11-865E-B37CC73BA821}-20260515-081438.png


The initial flow, will require 2 more actions before it is complete. First crate a new resources:

  1. A new variable to hold the API request parameters

    Resource type: Variable
    API Name: PostTaskBody
    Data Type: Apex-Defined
    Apex Class: ExternalService__TaskAPIExternalService_PostTaskRequest

    {4C0B8044-8E2B-43AC-88C2-9EF57176D414}-20260515-083143.png



  1. Add an Assignment Action after the Get Records action.

    {E60F5A58-CB9E-4FCE-BA48-0224C21D2BD4}-20260515-083419.png


The Get Template action will by default look for the “Sample Quote” template provided above. If your template is named diffrenently, update the Get Records action accordingly.


  1. Set the Variable Values as follows:

Variable

Operator

Value

{!PostTaskBody.template}

Equals

{!Get_Template.Id}

{!PostTaskBody.params.id}

Equals

{!AgentVar}

{!PostTaskBody.integration.z0type}

Equals

Salesforce

{!PostTaskBody.integration.serverURL}

Equals

{!$Api.Partner_Server_URL_570}

The final result should look something like this:

{DD133B9C-3603-42F3-A1D8-20CD5126079F}-20260515-091619.png


  1. Finally, add the API Call action itself. In the Add Element, search for “Post Task and add it. Give the action a name, such as “Post Task” and assign it the post task body: {!PostTaskBody}

    {BFA7737E-A1E6-4DAB-B3D8-2E1A3C03EA2C}-20260515-084137.png


    Leave the Client Id and Client Secret as not included in this step.

  2. Save the modified flow as a new version. This flow is already connected to the Subagent included in this package.

    {42E3C060-CABD-4BCF-8F37-CCD47E0427E9}-20260515-084213.png

Setting up the Agent

The Agentforce Connector package comes with a pre-defined subagent. This subagent can simply be added to an existing or new Agent.


If you do not yet have an Agent, now is the time to create one. From the Salesforce setup, open Agentforce Agents.

{B1930111-F19F-4FE6-94AF-8022A38B6E5D}-20260508-114057.png

From here, you can either modify an existing agent, or create a brand new one using the “+New Agent” button on the top right.

If creating a new Agent, we suggest using the “Agentforce Employee Agent” as the starting point.

{DFAB930F-E1D7-44BB-9F36-585FC06DCEB8}-20260508-114148.png



From within the Agentforce Builder, add a new Subagent from Asset Library. The Subagents is connected to the Flow from the previous step and has pre-configured instructions.

{35CF8DB6-AC25-42B3-9839-AF6DAE60B547}-20260515-084512.png


Search for and add the Subagent named “DocumillOpportunitySubagent”.

{1B377E36-FA1C-4853-B6B4-7F951FE84068}-20260515-084534.png


Once the Subagent is added, click on the newly added subagent.

{76F1D9C3-7CE2-4938-AB1D-2A70FC7DF97F}-20260515-084618.png


Add a few example inputs to the Subagent, something that the users may say to the agent.

Example:

“Create Quote for this opportunity 006XXXXXXXX”

“Create a proposal for [name of the opportunity] opportunity”

Click Save and Activate the Agent. If Configuration Issues are detected, click “Ignore & Activate“.

Now, its a good time to test the Agent. Ask the Agent to generate a quote document as an example.

{56F93AA2-1F82-490F-AC68-F4B114C86963}-20260515-093643.png


Ensure that the DocumillOpportunitySubagent is correctly triggered.

{81F7EB0E-A85A-4038-A7D4-97EAC8F2D7B4}-20260515-085050.png


If the Agent worked correctly, a Quotation should appear under that Opportunity Attachments.

{B6A8F486-98D4-495C-8474-4014A31C7EDB}-20260515-093725.png