'JSON request for envelope with single document, two signers, pre-fill fields

I have an envelope with a single document and two signers saved as a server-side template. The signers execute the agreement in a specific order. The document has a number of pre-fill fields in it.

I am trying to automate sending this agreement out using Integromat. Unfortunately, Integromat's module doesn't allow for pre-fill fields in templates, leaving me to create the API request manually. This is where I get stuck.

The closest I have come is the JSON request below, POSTed to: …/v2.1/accounts/{accountId}/envelopes, with capitalised values filled in automatically:

{
  "templateId": "TEMPLATE_ID",
  "templateRoles": [
    {
      "email": "CLIENT_EMAIL",
      "name": "CLIENT_NAME",
      "roleName": "Recipient",
      "tabs": {
        "prefillTabs": {
          "textTabs": [{
            "tabLabel": "Prefill: Purpose",
            "value": "PURPOSE_FIELD_DATA"
          }]
        }
      }
    }, {
      "email": "STAFF_EMAIL",
      "name": "STAFF_NAME",
      "roleName": "Company"
    }
  ],
  "status": "sent"
}

The response from the API is:

The operation failed with an error. [400] A Required field is incomplete. TabId: GUI_HERE

What I can't figure out is how to get the pre-fill data submitted since it's not tied to a particular signer. I have scoured the v2.1 API documentation but there is no scenario simple enough for this request.

Apologies if I am missing something obvious here; this is my first rodeo with DocuSign's API.

Do you have any idea what I am doing wrong or, better yet, what the body of the request should be for this (presumably) simple scenario?



Solution 1:[1]

Update: For pre-fill tabs, you need to have both the tabId and tabLabel, not enough to just have tabLabel like regular tabs.

My guess is a mismatch of the tabId field for the tabs on your template vs. what's in the API request: You had this value in your request:

Prefill: Purpose

Does it match how the template was set?

Solution 2:[2]

I just tried this with composite templates. When I added the prefill tabs to a recipient I received the error

Error code: INVALID_TAB_OPERATION.

Message: The Tab specified is not valid for the requested operation. 
PrefillTab not allowed for recipient.

which makes sense since prefill tabs are associated with a document, not a recipient.

I tried by adding a document to the composite template, but that didn't work either.

I suggest that you use regular tabs. Mark them locked so they can't be changed. Mark them shared so every signer will see them. Then fill in their values as part of your Envelopes:create call.

Here's a live example of doing this. Note the text2 tab which is locked. (It should have the shared attribute set to true. You can add that from the Tabs/text toolbox on the left.)

Also see this blog post about templates.

Solution 3:[3]

Integromat does even without using DocuSign Rest APIs. You can use Powerforms, it will save your cost for Rest APIs.

I recently did this, but issue is for first recipient, you need to send email manually with powerform link.

Here I dynamically construct PowerForm URL where I pass values to pre populate template fields.

To send email from integromat, you can configure Gmail module or any other email module and create html template where you can append Powerform URL in anchor tag

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Larry K
Solution 3 Shyam