user2954587
user2954587

Reputation: 4871

Docusign Compoite Templates multiple server templates

I'm trying to render two templates together using the compositeTemplates attribute. However only the second one gets included. I believe this structure is correct because I can get one or the other if I just comment one out. According to the documentation all I should need to set is the sequence. How can I get both server templates to be included in one envelope?

'emailSubject': "test doc",
'emailBurb': 'this is a test doc',
'status': 'sent',
'compositeTemplates': [{
    'serverTemplates': [
        # LT
        {
            'sequence': '1',
            'templateId': '9FA06158-4789-4473-B435-F81BF2C7D1D0',
        },
    ],
    'serverTemplates': [
    # ST 
        {
            'sequence': '2',
            'templateId': '235E5E2C-D4F1-4043-AE7E-793DD89268F3',
        },
    ],
    'inlineTemplates': [{
        'sequence': '1',
        'recipients': {
            'signers': [{
                'email': send_to,
                'name': "Tester",
                'recipientId': '1',
                'roleName': 'Signer',
                    'tabs': {
                    'textTabs': [
                        {
                            'tabLabel': 'full_address',
                            'value': 'Massachusetts'
                        },
                    ],
                },
            }],
        },
    }],
    'inlineTemplates': [{
        'sequence': '2',
        'recipients': {
            'signers': [{
                'email': send_to,
                'name': "Tester",
                'recipientId': '1',
                'roleName': 'Signer',
                    'tabs': {
                    'textTabs': [
                        {
                            'tabLabel': 'full_address',
                            'value': 'Massachusetts'
                        },
                    ],
                },
            }],
        },
    }],


}]

Upvotes: 0

Views: 96

Answers (1)

Jeff Kyllo
Jeff Kyllo

Reputation: 698

The request you have there is actually combining the two server-templates. The sequence in this case determines which documents/recipients take priority. To included them both as a separate documents, you'd want something more like the below. This has two composite templates. Each one combines a server-side template with an in-line template. I haven't tested this, but it should get you going.

'emailSubject': "test doc",
'emailBurb': 'this is a test doc',
'status': 'sent',
'compositeTemplates': [{
    'serverTemplates': [
        # LT
        {
            'sequence': '1',
            'templateId': '9FA06158-4789-4473-B435-F81BF2C7D1D0',
        },
    ],
    'inlineTemplates': [{
        'sequence': '2',
        'recipients': {
            'signers': [{
                'email': send_to,
                'name': "Tester",
                'recipientId': '1',
                'roleName': 'Signer',
                    'tabs': {
                    'textTabs': [
                        {
                            'tabLabel': 'full_address',
                            'value': 'Massachusetts'
                        },
                    ],
                },
            }],
        },
    }]
},
{
    'serverTemplates': [
    # ST 
        {
            'sequence': '1',
            'templateId': '235E5E2C-D4F1-4043-AE7E-793DD89268F3',
        },
    ],
    'inlineTemplates': [{
        'sequence': '2',
        'recipients': {
            'signers': [{
                'email': send_to,
                'name': "Tester",
                'recipientId': '1',
                'roleName': 'Signer',
                    'tabs': {
                    'textTabs': [
                        {
                            'tabLabel': 'full_address',
                            'value': 'Massachusetts'
                        },
                    ],
                },
            }],
        },
    }],
}]

Upvotes: 1

Related Questions