Skip to main content
Blog
Home/

Pro tips for working with composite templates, Part III

Author Nima Poulad
Nima PouladSenior Developer Advocate
Summary3 min read

See how to use the API to have each recipient sign their own instance of your reference template.

    • Additional resources

    Table of contents

    In Part II of this blog series, I showed you how to override a document in a template while still using its tabs. In this post, I'm  going to talk about reusing templates for different recipients in the same envelope. How can you have two recipients sign their own separate instances of your reference template?

    The answer for that scenario is to use composite templates. Imagine you have set up a template with a “Seller” role that defines where the tabs should be placed in a document, identical to the had setup in Part II. You can use this template in individual composites and scope the tabs to the recipients in each composite. For example:

    {
      "emailSubject": "Document-scoped anchors with template",
      "status": "sent",
      "compositeTemplates": [
         {
       "compositeTemplateId": "1",
         "document" :
           {
             "documentId" : "1",
               "name": "Doc1",
               "documentBase64": "Doc1 Base64"
           },
            "inlineTemplates": [
               {
                  "recipients": {
                     "signers": [
                        {
                           "email": "john@hiscompany.com",
                           "name": "John Smith",
                           "recipientId": "1",
                           "roleName": "Seller"
                        }
                     ]
                  },
                  "sequence": "2"
               }
            ],
            "serverTemplates": [
               {
                  "sequence": "1",
                  "templateId": "867a37ef-xxxx-xxxx-xxxx-1a3619ada310"
               }
            ]
         },
         {
       "compositeTemplateId": "2",
         "document" :
           {
             "documentId" : "1",
             "documentBase64": "Doc2 Base64",
             "name": "Doc2"
           },
            "inlineTemplates": [
               {
                  "recipients": {
                     "signers": [
                        {
                           "email": "joe@hiscompany.com",
                           "name": "Joe Bar",
                           "recipientId": "1",
                           "roleName": "Seller"
                        }
                     ]
                  },
                  "sequence": "2"
               }
            ],
            "serverTemplates": [
               {
                  "sequence": "1",
                  "templateId": "867a37ef-xxxx-xxxx-xxxx-1a3619ada310"
               }
            ]
         }
      ]
    }
    
    

    Three important points:

    1. Notice the sequence numbers for each composite. The serverTemplate gets sequence = 1 and its document is replaced with the one you provide. The inlineTemplates where you specify the signers get the second sequence number. 

    2. Notice how both composites are referencing the same template ID. This is because you want to use the same tabs layout as defined in the template. Since the tabs are document-scoped, one will not affect the other.

    3. Notice how all the signers have the role “Seller”, which is the same role that was created in the serverTemplate (where you define where each tab must be placed.)

    Thank you for reading this article. I hope you are starting to see how powerful composite templates can be!

    Additional resources

    Author Nima Poulad
    Nima PouladSenior Developer Advocate

    Nima Poulad is a Senior Developer Advocate at Docusign. He has years of experience in the industry as a software developer and as an advocate. He enjoys meeting the members of developer community and passionate about sharing what he knows with others.

    Find him on Twitter: @NimaPoulad or LinkedIn.

    More posts from this author

    Related posts

    • Docusign 2024 Release 3: Capture the Critical Business Value Hidden in Your Agreements
      Intelligent Agreement Management

      Docusign 2024 Release 3: Capture the Critical Business Value Hidden in Your Agreements

    • How to improve your app’s UX while users wait for API calls to complete

      How to improve your app’s UX while users wait for API calls to complete

      Author Larry Kluger
      Larry Kluger
    • Trending Topics: Latest from our forums (November 2024)
      Author Paige Rossi
      Paige Rossi
    How to improve your app’s UX while users wait for API calls to complete

    How to improve your app’s UX while users wait for API calls to complete

    Author Larry Kluger
    Larry Kluger
    Trending Topics: Latest from our forums (November 2024)
    Author Paige Rossi
    Paige Rossi

    Discover what's new with Docusign IAM or start with eSignature for free

    Explore Docusign IAMTry eSignature for Free
    Person smiling while presenting