0

I saw the example in docusign to do it like so:

Both Server Template and Inline Template have the same sequence number per composite template Notice:

CompositeTemplate: ServerTemplate Sequence = 1
                   InlineTemplate Sequence = 1
CompositeTemplate: ServerTemplate Sequence = 2
                   InlineTemplate Sequence = 2

{
    "emailSubject": "DocuSign API - Composite Templates",
    "emailBlurb": "Composite Templates Sample 1",
    "status": "sent",
    "compositeTemplates": [{
        "serverTemplates": [{
            "sequence": "1",
            "templateId": "55A80182-2E9F-435D-9B16-FD1E1C0F9D74"
        }],
        "inlineTemplates": [{
            "sequence": "1",
            "recipients": {
                "signers": [{
                    "email": "johndoe@email.com",
                    "name": "John Doe",
                    "recipientId": "1",
                    "roleName": "Buyer"
                }]
            }
        }]
    }, {
        "serverTemplates": [{
            "sequence": "2",
            "templateId": "44D9E888-3D86-4186-8EE9-7071BC87A0DA"
        }],
        "inlineTemplates": [{
            "sequence": "2",
            "recipients": {
                "signers": [{
                    "email": "sallydoe@email.com",
                    "name": "Sally Doe",
                    "recipientId": "1",
                    "roleName": "Seller"
                }]
            }
        }]
    }]
}

But I also saw in some stack overflow to use it this way:

Multiple Server Templates have the same sequence number, and the inline Templates are the difference

CompositeTemplate: ServerTemplate Sequence = 1
                   InlineTemplate Sequence = 2
CompositeTemplate: ServerTemplate Sequence = 1
                   InlineTemplate Sequence = 2
    {
        "emailSubject": "DocuSign API - Composite Templates",
        "emailBlurb": "Composite Templates Sample 1",
        "status": "sent",
        "compositeTemplates": [{
            "serverTemplates": [{
                "sequence": "1",
                "templateId": "55A80182-2E9F-435D-9B16-FD1E1C0F9D74"
            }],
            "inlineTemplates": [{
                "sequence": "2",
                "recipients": {
                    "signers": [{
                        "email": "johndoe@email.com",
                        "name": "John Doe",
                        "recipientId": "1",
                        "roleName": "Buyer"
                    }]
                }
            }]
        }, {
            "serverTemplates": [{
                "sequence": "1",
                "templateId": "44D9E888-3D86-4186-8EE9-7071BC87A0DA"
            }],
            "inlineTemplates": [{
                "sequence": "2",
                "recipients": {
                    "signers": [{
                        "email": "sallydoe@email.com",
                        "name": "Sally Doe",
                        "recipientId": "1",
                        "roleName": "Seller"
                    }]
                }
            }]
        }]
    }

I tried to read the docusign api doc, but still not sure when to use each scenario

Harts
  • 4,023
  • 9
  • 54
  • 93

2 Answers2

0

Based on my experience, you're correct in suggesting that DocuSign API documentation about the sequence property is somewhat lacking. That said, here's a link to an (older) API documentation page that describes it as good as I've seen it described anywhere: https://www.docusign.com/p/APIGuide/Content/Sending%20Group/Rules%20for%20CompositeTemplate%20Usage.htm.

As this documentation describes, the purpose of the sequence property in the composite templates structure is to specify the order in which you want DocuSign to apply the templates you specify (ServerTemplates, InlineTemplates, etc.) as it creates the Envelope. Personally, I've always done as the example in the documentation shows, and specified incremental values for sequence throughout the templates that are present in the request body. In your example, this would mean using the following values:

CompositeTemplate: ServerTemplate Sequence = 1
                   InlineTemplate Sequence = 2
CompositeTemplate: ServerTemplate Sequence = 3
                   InlineTemplate Sequence = 4
Kim Brandl
  • 13,125
  • 2
  • 16
  • 21
0

Sequence number in one composite template does not affect the sequence number of other composite template. Which means, if you have an array of Composite Template, then sequence number defined in each composite template element of array is independent of sequence number defined in an another composite template.

Now lets go into each composite template, for adding document into composite template, lower the sequence value that document will become the base document of that composite template. For instance,

CompositeTemplate: ServerTemplate Sequence = 1
                   InlineTemplate Sequence = 2

In above scenario, document to this composite template will be provided by Server Template, whereas in below scenario,

CompositeTemplate: ServerTemplate Sequence = 2
                   InlineTemplate Sequence = 1

Document will come from Inline Template, it will override the document present in the server template.

But the rule for sequence number changes for the recipient information. Template having higher sequence number will add the recipient information to the composite template.

So in nutshell, document is added to a composite template with the lower value, and recipient information is added with the higher value.

Mostly, you will see use of Composite Template as:

CompositeTemplate: ServerTemplate Sequence = 1
                   InlineTemplate Sequence = 2

In above scenario, document will be added from ServerTemplate (lower sequence value) and Recipient Info will be added from Inline Template (higher sequence value).

Amit K Bist
  • 6,760
  • 1
  • 11
  • 26
  • Quick Question, the docusign api have the type of example where it looks like. Server Template sequence = 1, Inline Template Sequence = 1, and the next composite template have Server Template sequence = 2, Inline Template sequence = 2. What does that mean in that case? – Harts Dec 08 '17 at 16:11
  • If sequence number is same in Inline and Server Template then document will be added to an envelope from server template. So an example is same like putting serverTemplate sequence as 1 and inlineserverTemplate sequence as 2. Sequence numbers in two different composite template does not affect each other. Above example does not go into detail when sequence number value becomes critical, as they were using very simple scenario when document will come from ServerTemplate and recipientInfo from Inline Template. – Amit K Bist Dec 08 '17 at 16:24
  • But ideally you should clearly mention sequence number properly so that when any other developer reads the code, he/she can understand the use and significance of sequence number. – Amit K Bist Dec 08 '17 at 16:24