Search code examples
docusignapidocusigncompositetmpltse-signature

Composite Template - signHere tabs all appear on the first document


I have two templates defined, each has a primary.account.holder role and associated signHere tab placed in appropriate place in each. If I run each one individually, i.e., create an envelope and add my recipient, then the tabs are placed as I'd expect.

The first template's document is 11 pages long with a signHere tab on the 10th page. The second template's document is 4 pages long with a signHere tab on the last page.

What I'd like to do is to create an envelope containing both of these templates, with a single signer. To do this I'm constructing a composite template with both of the templates above.

I've run into the following issue: the documents are ordered correctly in the envelope, however the tabs all appear on the first document, and the second document doesn't have any tabs at all. (The first document gets a signHere tab on the 10th pages as it should, but it also has one on the 4th page, where it should be in the second document, the second doc has no tabs.)

The envelope I'm submitting is below.

{
    "compositeTemplates": [
        {
            "document": {
                "documentBase64": "...",
                "documentId": "81",
                "fileExtension": "pdf",
                "name": "file-one.pdf",
                "order": "1"
            },
            "inlineTemplates": [
                {
                    "recipients": {
                        "signers": [
                            {
                                "email": "[email protected]",
                                "name": "Doe, Jane",
                                "recipientId": "35916331",
                                "roleName": "primary.account.holder",
                                "routingOrder": "1"
                            }
                        ]
                    },
                    "sequence": "2"
                }
            ],
            "serverTemplates": [
                {
                    "sequence": "1",
                    "templateId": "0058ab16-22e7-4877-ace1-2022bf8566b8"
                }
            ]
        },
        {
            "document": {
                "documentBase64": "...",
                "documentId": "80",
                "fileExtension": "pdf",
                "name": "file-two.pdf",
                "order": "2"
            },
            "inlineTemplates": [
                {
                    "recipients": {
                        "signers": [
                            {
                                "email": "[email protected]",
                                "name": "Doe, Jane",
                                "recipientId": "35916331",
                                "roleName": "primary.account.holder",
                                "routingOrder": "1"
                            }
                        ]
                    },
                    "sequence": "2"
                }
            ],
            "serverTemplates": [
                {
                    "sequence": "1",
                    "templateId": "7b1282bf-051b-47b8-bd31-473c1423be4d"
                }
            ]
        }
    ],
    "emailSubject": "Please sign this document set.",
    "status": "sent"
}

I'm using the same signer and same recipientId for both inline templates, but I've also tried using a different recipientIds with no luck. (edit - not relevant)

It's not clear to me what I'm doing wrong. I've worked through some of the composite template documentation, but I haven't seen anything that would stick out as obviously wrong with my envelope. How can I get the tabs placed on each document rather than just the first?

UPDATE ONE

This question is similar to my issue. There are two parts to the solution that poster found: 1) inline templates need to be sequenced before server templates, and 2) "you must have the Anchor Population Scope value in your account set to 'Document'."

Item 1 by itself doesn't do anything. Item 2 is interesting - I haven't done it yet. I'm going to deploy my solution into a DocuSign account that already has at least one DocuSign app in production. Does this setting affect all DocuSign apps for a given account? If so, that's unfortunate.

UPDATE TWO

I'm not convinced that I'll be given the okay to turn on the 'Anchor Population Scope' flag for an entire account when that account has multiple docusign apps. So...

I don't know if this is a solution, but it seems to work. I'm still using a composite template, but I'm not using a serverTemplate, and I'm including statically positioned tabs with the signers. The envelope looks like this:

{
    "compositeTemplates": [
        {
            "document": {
                "documentBase64": "...",
                "documentId": "1",
                "fileExtension": "pdf",
                "name": "file-one.pdf",
                "order": "1",
                "pages": "11"
            },
            "inlineTemplates": [
                {
                    "recipients": {
                        "signers": [
                            {
                                "deliveryMethod": "email",
                                "email": "[email protected]"
                                "roleName": "primary.account.holder",
                                "tabs": {
                                    "signHereTabs": [
                                        {
                                            "documentId": "1",
                                            "pageNumber": "11",
                                            "xPosition": "80",
                                            "yPosition": "534"
                                        }
                                    ]
                                }
                            }
                        ]
                    },
                    "sequence": "1"
                }
            ]
        },
        {
            "document": {
                "documentBase64": "...",
                "documentId": "2",
                "fileExtension": "pdf",
                "name": "page-two.pdf",
                "order": "2",
                "pages": "4"
            },
            "inlineTemplates": [
                {
                    "recipients": {
                        "signers": [
                            {
                                "deliveryMethod": "email",
                                "email": "[email protected]",
                                "tabs": {
                                    "signHereTabs": [
                                        {
                                            "documentId": "2",
                                            "pageNumber": "4",
                                            "xPosition": "80",
                                            "yPosition": "160"
                                        }
                                    ]
                                }
                            }
                        ]
                    },
                    "sequence": "1"
                }
            ]
        }
    ],
    "emailBlurb": "Please sign this document set (smoke-test)",
    "emailSubject": "Please sign this document set (smoke-test)",
    "status": "sent"
}

This gives me the ability to compose envelopes with multiple forms many of which have the same signer, and not have those tabs show up on the first document in the envelope.

I've got at least 10-15 forms many of which will need to be combined in ways that aren't conveniently captured in individual templates.

So, I just need to associate a tabs collection for each signer within a form, then create a composite template using a document (generated in my case) and an inline template that includes tabs for each signer.

The static positioning rather than anchor positioning gets around the need for the 'Anchor Position Scope' flag, at the cost of me needing to keep track of tab data myself rather than in a template (which is unfortunate.)


Solution

  • The envelope described in 'Update 2' above resolved the issue for me. Setting the 'Anchor Population Scope' to document rather than envelope probably would have worked as well. However, in my situation I'm not confident doing it at the account level would be approved given there are the apps in the account.

    Basically, composite templates are super flexible and I can take advantage of that to work around my original issue.