0
votes

I've created a template in my dev sandbox. In that template I created custom fields and changed the data label to reflect what is in the codebase.

From there, I've done a httpRequest with an envelope, referencing that template id, with "tabs":{"textTabs":[{"tabLabel":"CurrentUnit","value":"Test Unit"}]} as the reference to the custom fields. CurrentUnit is the data label for my template in the dev sandbox. The template isn't being emailed after my httpRequest from my application, but that field isn't getting populated, and I'm thoroughly stumped. Any ideas?

Also, if I do a Get request for tab_definitions, it shows those custom fields that I created.

The request url looks like this: https://dev.docusign.net/restapi/v2/accounts/{accountId}/envelopes The header is just the Bearer auth token and Content-Type

The request body looks like this:

{   "accountId":"{accountId}",
    "emailSubject":"Test",
    "templateId":"{templateId}",
    "templateRoles":[
        {
            "roleName":"Signer",
            "name":"Liam",
            "email":"{[email protected]}",
            "tabs":{
                "textTabs":[{
                    "tabLabel":"currentUnit",
                    "value":"Test Unit"

                }]}}],
                "status":"sent"
            }






1
Would you include the full request in your question? (please remove sensitive IDs) - Matthew Roknich
@MatthewRoknich I cleaned up the format and put it in a code block. Sorry about that horrible format earlier. - bell19026

1 Answers

1
votes

You can use DocuSign compositeTemplates and specify the recipient custom fields. templateRoles does not support specifying recipient custom fields.

Here is an example that works for me. I used a template from the DocuSign UI with two signer recipients, each assigned one "sign here" tab.

Additionally, the first signer has a custom text label. Programatically changing the initialValue below.

{
    "emailSubject": "Test",
    "status": "sent",
    "compositeTemplates": [
        {
            "serverTemplates": [
                {
                    "sequence": "1",
                    "templateId": "{Enter your template ID}"
                }
            ],
            "inlineTemplates": [
                {
                    "sequence": "1",
                    "recipients": {
                        "signers": [
                            {
                                "email": "{Enter email}",
                                "name": "jane doe",
                                "recipientId": "2",
                                "roleName": "{Enter Role}",
                                "routingOrder": "1",
                                "tabs": {
                                    "textTabs": [
                                        {
                                            "tabLabel": "{theLabelName}",
                                            "value": "{newValue}"
                                        }
                                    ]
                                }
                            },
                            {
                                "email": "{another Email}",
                                "name": "john doe",
                                "recipientId": "3",
                                "roleName": "{another Role}",
                                "routingOrder": "1"
                            }
                        ]
                    }
                }
            ]
        }
    ]
} 

For more information on Composite Templates (pros and cons), I would highly encourage this blog post by a great DocuSigner, Gil V.