4

How do I specify prefilled fields with composite templates when creating an envelope.

I tried including the tabs information in the inlineTemplate.recipients.signers[0].tabs, but I get an error that System.String cannot be cast to API_REST.Models.v2.tabs.

If I include information as a template role in templateRoles, it is ignored. The documentation is light on information about how to do this. It seems like the prefill data should be specified in the inline template.

Other open questions I have include what does the recipientId do. What is the clientUserIdused for? We currently set clientUserId to the same value for all signers. I see it's used when signer requests a signature. Should it be unique to every signer for some reason?

It also looks like a single composite template overlays the server and inline templates on top of each other. What's the use case for having multiple server templates or multiple inline templates in a single composite template?

Are there plans to improve the documentation to describe how to use composite templates for various purposes?

Signer/template role:

{
  "clientUserId": "clientUserId",
  "email": "first+last@email.com",
  "name": "First Last",
  "roleName": "role1",
  "tabs": {
    "textTabs": [
      {
        "locked": true,
        "tabLabel": "\\*FieldName",
        "value": "prefillValue"
      }
    ]
  }
}

Example request:

{
  "compositeTemplates": [
    {
      "inlineTemplates": [
        {
          "recipients": {
            "signers": [
              {
                "clientUserId": "clientUserId",
                "email": "first+last@email.com",
                "name": "First Last",
                "recipientId": 1,
                "roleName": "role1",
                "tabs": {
                  "textTabs": [{"tabLabel": "label", "value": "val"}]
                }
              }
            ]
          },
          "sequence": 1
        }
      ],
      "serverTemplates": [
        {
          "sequence": 1,
          "templateId": "templateId1"
        }
      ]
    },
    {
      "inlineTemplates": [
        {
          "recipients": {
            "signers": [
              {
                "clientUserId": "clientUserId",
                "email": "first+last@better.com",
                "name": "First Last",
                "recipientId": 1,
                "roleName": "role1",
                "tabs": {
                  "textTabs": [{"tabLabel": "label", "value": "val"}]
                }
              }
            ]
          },
          "sequence": 2
        }
      ],
      "serverTemplates": [
        {
          "sequence": 2,
          "templateId": "templateId2"
        }
      ]
    }
  ],
  "emailSubject": "Email subject",
  "status": "sent",
  "templateId": null,
  "templateRoles": null
}
Larry K
  • 47,808
  • 15
  • 87
  • 140
Esmael
  • 43
  • 4

1 Answers1

3

Information on sending an envelope from a server template can be found here.

RecipientID is used by the tab element to indicate which recipient is to sign the Document while the clientuserID specifies if the user is remote or embedded and it is recommended it be unique per signer (but not required).

I'd also suggest reading this page about composite templates, hopefully the concept will make a bit more sense but I am with you that the lack of documentation on composite templates can be troublesome.

Unfortunately, I don't have a sample with tab data included, but adding the tab section under each recipient from my sample below should work with no issues.

{
  "emailSubject": "DocuSign Comp Test 1",
  "emailBlurb": "Example - Composite Templates",
  "status": "sent",
  "compositeTemplates": [
    {
      "serverTemplates": [
        {
          "sequence": "1",
          "templateId": "templateId1"
        }
      ],
      "inlineTemplates": [
        {
          "sequence": "1",
          "recipients": {
            "signers": [
              {
                "email": "testsigner123@gmail.com",
                "name": "Test Tester",
                "recipientId": "1",
                "roleName": "Signer 1"
              }
            ]
          }
        }
      ]
    },
    {
      "serverTemplates": [
        {
          "sequence": "2",
          "templateId": "templateId2"
        }
      ],
      "inlineTemplates": [
        {
          "sequence": "2",
          "recipients": {
            "signers": [
              {
                "email": "testsigner123@gmail.com",
                "name": "Test Tester",
                "recipientId": "1",
                "roleName": "Signer 1"
              }
            ]
          }
        }
      ]
    },
    {    
      "serverTemplates": [
        {
          "sequence": "3",
          "templateId": "templateId3"
        }
      ],
      "inlineTemplates": [
        {
          "sequence": "2",
          "recipients": {
            "signers": [
              {
                "email": "testsigner123@gmail.com",
                "name": "Test Tester",
                "recipientId": "1",
                "roleName": "Signer 1"
              }
            ]
          }
        }
      ]
    }
  ]
}
Rickey S
  • 1,234
  • 6
  • 10
  • Thanks for the reply. I've read through those doc pages before. I am still unclear on where to specify the tab information. I tried including it at the root level `templateRoles`, under `inlineTemplates[0]`, under `inlineTemplates[0].recipients`, and under `inlineTemplates[0].recipients.singers[0]`. All but the last configuration is ignored. The last one (where it seems like it should go) returns an error. – Esmael Nov 28 '15 at 15:01
  • 1
    I was able to add tabs under the signer. I was running into an encoding problem with the docusign client I am using. Thank you. – Esmael Dec 01 '15 at 21:45
  • Glad you got it working. I just read through my post and realized I did say add the tab info under "Recipients" when it should be further under that with "Signers." My apologies!!! – Rickey S Dec 03 '15 at 00:25
  • The documentation isn't great around this area. I was trying to add the tab data to the template roles. Shifting it to the recipient of the inline template worked for me. Thanks. – Gav Apr 09 '21 at 09:12