docusignapidocusigncompositetmplts

Custom Fields on envelope via API with Composite Templates


I am trying to create 2 custom fields when creating an Envelope from templates using composite templates below is the json.

{
    "emailSubject": "This is a new",
    "status": "sent",
    "compositeTemplates": [
        {
            "inlinetemplates": [
                {
                    "sequence": "2",
                    "recipients": {
                        "signers": [
                            {
                                "email": "email@email.com",
                                "name": "Jimmy Nobody",
                                "clientuserid": "1",
                                "recipientid": "1",
                                "rolename": "signer",
                                "dfaultrecipient": "true",
                                "tabs": {
                                    "texttabs": [
                                        {
                                            "name": "Text",
                                            "tabLabel": "name",
                                            "value": "Joe Smith"
                                        },
                                        {
                                            "name": "Text",
                                            "tabLabel": "address",
                                            "value": "987 apple lane"
                                        }
                                    ]
                                }
                            }
                        ]
                    }
                }
            ],
            "servertemplates": [
                {
                    "sequence": "1",
                    "templateId": "52be0f34-d8aa-420f-8283-4e9cc2bb499f"
                }
            ]
        },
        {
            "inlinetemplates": [
                {
                    "sequence": "2",
                    "recipients": {
                        "signers": [
                            {
                                "email": "email@email.com",
                                "name": "Jimmy Nobody",
                                "clientuserid": "1",
                                "recipientid": "1",
                                "rolename": "signer",
                                "dfaultrecipient": "true",
                                "tabs": {
                                    "texttabs": [
                                        {
                                            "name": "Text",
                                            "tabLabel": "name",
                                            "value": "Joe Smith"
                                        },
                                        {
                                            "name": "Text",
                                            "tabLabel": "address",
                                            "value": "987 apple lane"
                                        }
                                    ]
                                }
                            }
                        ]
                    }
                }
            ],
            "servertemplates": [
                {
                    "sequence": "1",
                    "templateId": "e00b896b-4ac7-48b1-8280-bfe3830a61f1"
                }
            ]
        }
    ],
    "customFields": {
        "textCustomFields": [
            {
                "name": "callingsystem",
                "required": "true",
                "show": "false",
                "value": "3e56cabd-6211-4203-a462-a7ff960a6b9c"
            },
            {
                "name": "callingsystemid",
                "required": "true",
                "show": "false",
                "value": "crm"
            }
        ]
    }
}

The problem is that this JSON is accepted and and envelope is created but no custom fields are on the envelope. What am i doing wrong?


Solution

  • You want to put it inside the inline templates tag. Also your formatting was a bit off and you had a typo in defaultRecipient

    Try this:

    {
        "emailSubject": "This is a new",
        "status": "sent",
        "compositeTemplates": [
            {
                "serverTemplates": [
                    {
                        "sequence": "1",
                        "templateId": "52be0f34-d8aa-420f-8283-4e9cc2bb499f"
                    }
                ]
            },
            {
                "serverTemplates": [
                    {
                        "sequence": "1",
                        "templateId": "e00b896b-4ac7-48b1-8280-bfe3830a61f1"
                    }
                ]
            },
            {
                "inlineTemplates": [
                    {
                        "sequence": "2",
                        "customFields": {
                            "textCustomFields": [
                                {
                                    "name": "callingsystem",
                                    "required": "true",
                                    "show": "false",
                                    "value": "3e56cabd-6211-4203-a462-a7ff960a6b9c"
                                },
                                {
                                    "name": "callingsystemid",
                                    "required": "true",
                                    "show": "false",
                                    "value": "crm"
                                }
                            ]
                        },
                        "recipients": {
                            "signers": [
                                {
                                    "email": "email@email.com",
                                    "name": "Jimmy Nobody",
                                    "clientuserid": "1",
                                    "recipientid": "1",
                                    "rolename": "signer",
                                    "defaultrecipient": "true",
                                    "tabs": {
                                        "texttabs": [
                                            {
                                                "name": "Text",
                                                "tabLabel": "name",
                                                "value": "Joe Smith"
                                            },
                                            {
                                                "name": "Text",
                                                "tabLabel": "address",
                                                "value": "987 apple lane"
                                            }
                                        ]
                                    }
                                }
                            ]
                        }
                    }
                ]
            }
        ]
    }