Docusign Composite Template unexpected behavior

58 views Asked by At

I'm a Java developper and I'm trying to use docusign composite template but I have some issues. I created 3 template A,B,C on docusign which have one different document each and 1 signature area on each document, the signature of the document A is on the first page, for B it's on the third page.

What I would like to do, is create an envelop with 3 new documents, and apply a template on each document. So I upload document 1 which match with template A, document 2 with template B etc..

But currently when I do that. It seems that the template are merged and the first document have several templates in it, so 2 signatures area, one on the first page (Template A) and one on the third page (Template C).

When I did that, the envelop is created with the 3 documents:
But document A have template A and B,
document B does not have any template.
document C have template C.

I tried to do so with API with this request

{
  "status": "created",
  "templateId": "TEMPLATE_D",
  "templateRoles": [
    {
      "email": "xx",
      "name": "xx",
      "roleName": "Signer"
    }
  ],
  "compositeTemplates": [
    {
      "compositeTemplateId": "1",
      "document": {
        "documentBase64": "x",
        "documentId": "1",
        "fileExtension": "doc",
        "name": "DOC_A'.doc",
        "order": "1"
      },
      "inlineTemplates": [
        {
          "recipients": {
            "signers": [
              {
                "email": "xx",
                "name": "xx",
                "recipientId": "1",
                "roleName": "Signer"
              }
            ]
          },
          "sequence": "2"
        }
      ],
      "serverTemplates": [
        {
          "sequence": "1",
          "templateId": "TEMPLATE_A"
        }
      ]
    },
    {
      "compositeTemplateId": "2",
      "document": {
        "documentBase64": "x",
        "documentId": "2",
        "fileExtension": "doc",
        "name": "DOC_B'.doc",
        "order": "2"
      },
      "inlineTemplates": [
        {
          "recipients": {
            "signers": [
              {
                "email": "xx",
                "name": "xx",
                "recipientId": "3",
                "roleName": "Signer"
              }
            ]
          },
          "sequence": "4"
        }
      ],
      "serverTemplates": [
        {
          "sequence": "3",
          "templateId": "TEMPLATE_B.doc"
        }
      ]
    },
    {
      "compositeTemplateId": "3",
      "document": {
        "documentBase64": "x",
        "documentId": "3",
        "fileExtension": "doc",
        "name": "DOC_C'.doc",
        "order": "3"
      },
      "inlineTemplates": [
        {
          "recipients": {
            "signers": [
              {
                "email": "xx",
                "name": "xx",
                "recipientId": "5",
                "roleName": "Signer"
              }
            ]
          },
          "sequence": "6"
        }
      ],
      "serverTemplates": [
        {
          "sequence": "5",
          "templateId": "TEMPLATE_C"
        }
      ]
    }
  ]
}

What I want is use the template D for the envelop. Substitue Doc A in the template A with a new doc A' to Keep only the signature AREA (the documents are quite the same except some wordings). Same with B' and C'

1

There are 1 answers

3
Larry K On

So to put it another way, you have a server template that you want to include in your envelope, but substitute a different document for the one in the template? And you want to do this 3 times (3 different server templates).

Try the following.

  "envelopeDefinition": {
    "status": "sent",
    "compositeTemplates": [
      {
        "document": {
          "filename": "anchorfields v2.docx",
          "documentId": "1",
          "name": "anchorfields v2.docx"
        },
        "serverTemplates": [
          {
            "templateId": "71a66510-ad60-49c8-b830-6db89072fc91",
            "sequence": "1"
          }
        ],
        "inlineTemplates": [
          {
            "sequence": "2",
            "recipients": {
              "signers": [
                {
                  "roleName": "signer1",
                  "email": "",
                  "name": "",
                  "recipientId": "1"
                },
                {
                  "roleName": "signer2",
                  "email": "",
                  "name": "",
                  "recipientId": "2"
                }
              ]
            }
          }
        ]
      },
      { // composite template 2
        "document": {
          "filename": "anchorfields v2.docx",
          "documentId": "2",
          "name": "anchorfields v2.docx"
        },
        "serverTemplates": [
          {
            "templateId": "71a66510-ad60-49c8-b830-6db89072fc91",
            "sequence": "3"
          }
        ],
        "inlineTemplates": [
          {
            "sequence": "4",
            "recipients": {
              "signers": [
                {
                  "roleName": "signer1",
                  "email": "",
                  "name": "",
                  "recipientId": "3"
                },
                {
                  "roleName": "signer2",
                  "email": "",
                  "name": "",
                  "recipientId": "4"
                }
              ]
            }
          }
        ]
      },
      { // composite template 3
        "document": {
          "filename": "anchorfields v2.docx",
          "documentId": "3",
          "name": "anchorfields v2.docx"
        },
        "serverTemplates": [
          {
            "templateId": "71a66510-ad60-49c8-b830-6db89072fc91",
            "sequence": "5"
          }
        ],
        "inlineTemplates": [
          {
            "sequence": "6",
            "recipients": {
              "signers": [
                {
                  "roleName": "signer1",
                  "email": "",
                  "name": "",
                  "recipientId": "5"
                },
                {
                  "roleName": "signer2",
                  "email": "",
                  "name": "",
                  "recipientId": "6"
                }
              ]
            }
          }
        ]
      }
    ]
  },