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

    • Leveraging Docusign AI and Salesforce for Improved Contract Management
      Developers

      Leveraging Docusign AI and Salesforce for Improved Contract Management

      Author Subbarao Pydikondala
      Subbarao Pydikondala
    • Event Notifications using JSON SIM and HMAC

      Event Notifications using JSON SIM and HMAC

      Author Jonathan Sammons
      Jonathan Sammons
    Leveraging Docusign AI and Salesforce for Improved Contract Management

    Leveraging Docusign AI and Salesforce for Improved Contract Management

    Author Subbarao Pydikondala
    Subbarao Pydikondala
    Event Notifications using JSON SIM and HMAC

    Event Notifications using JSON SIM and HMAC

    Author Jonathan Sammons
    Jonathan Sammons

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

    Explore Docusign IAMTry eSignature for Free
    Person smiling while presenting