0

I'm currently sending my signature request call in XML and have referred to the REST API guide as well as the example in Rules for Composite Template Usage and although I was able to successfully pull in the additional server templates in the appropriate sequence, the secure tabs in these templates were not editable; the only template that exposed these was the 'primary' template (not included in the composite templates object). From page 104 in the API guide it appears that the essence of inline templates is to augment the server templates declared (add documents, etc.). Here is my XML sample:

<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">
<accountId>#####</accountId>
<status>sent</status>
<emailSubject>testing 11/18 -3</emailSubject>
<emailBlurb>Email Blurb</emailBlurb>
<templateId>TEMPLATE ID 1</templateId>
<templateRoles>
<templateRole>
<email>insured@email.com</email>
<name>Insured Test</name>
<roleName>Signer</roleName>
</templateRole>
<templateRole>
<email>test@email.com</email>
<name>Test Agent</name>
<roleName>Agent</roleName>
</templateRole>
</templateRoles>
<compositeTemplates>
<compositeTemplate>
<serverTemplates>
<serverTemplate>
<sequence>1</sequence>
<templateId>TEMPLATE ID 2</templateId>
</serverTemplate>
</serverTemplates>
</compositeTemplate>
<compositeTemplate>
<serverTemplates>
<serverTemplate>
<sequence>2</sequence>
<templateId>TEMPLATE ID 3</templateId>
</serverTemplate>
</serverTemplates>
</compositeTemplate>
<compositeTemplate>
<serverTemplates>
<serverTemplate><sequence>3</sequence>
<templateId>TEMPLATE ID 4</templateId>
</serverTemplate></serverTemplates>
</compositeTemplate>
</compositeTemplates>
</envelopeDefinition>

Basically I need to be able to append server templates based upon parameters selected by the user to the primary.

EDIT: I'm assuming that I'd need to pass in template roles for each of the subsequent ID's, but the only place to pass that in would be an inline---which doesn't appear to be applicable for this use case.

EDIT2: Here's my request body with the updates. This time I'm getting INCOMPLETE_ENVELOPE.. I ran this against the API Explorer and for some reason when I added in the original top-level template ID and respective roles, I didn't get an error. When sending the updated XML I was able to create the envelope but the added composite templates weren't editable..

<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">
<accountId>1232456</accountId>
<status>sent</status>
<emailSubject>testing inline 11/18 -5</emailSubject>
<emailBlurb>This comes from me</emailBlurb>
<compositeTemplates>
<compositeTemplate>
<serverTemplates>
<serverTemplate>
<sequence>1</sequence>
<templateId>894ed334-4183-4b68-857e-01fe4829f79e</templateId>
</serverTemplate>
</serverTemplates>
<inlineTemplates>
<inlineTemplate>
<sequence>2</sequence>
<recipients>
<recipient>
<signers>
<signer>
<email>email@email.com</email>
<name>Test insured</name>
<roleName>Signer</roleName>
<recipientId>1</recipientId>
</signer>
<signer>
<email>test@gmail.com</email>
<name>Test Agent</name>
<roleName>Agent</roleName>
<recipientId>2</recipientId>
</signer>
</signers>
</recipient>
</recipients>
</inlineTemplate>
</inlineTemplates>
</compositeTemplate>
<compositeTemplate>
<serverTemplates>
<serverTemplate>
<sequence>3</sequence>
<templateId>d1c43bee-2c6b-4910-89f0-64e3fbcce19a</templateId>
</serverTemplate>
</serverTemplates>
<inlineTemplates>
<inlineTemplate>
<sequence>4</sequence>
<recipients>
<recipient>
<signers>
<signer>
<email>email@email.com</email>
<name>Test insured</name>
<roleName>Signer</roleName>
<recipientId>1</recipientId>
</signer>
<signer>
<email>test@gmail.com</email>
<name>Test Agent</name>
<roleName>Agent</roleName>
<recipientId>2</recipientId>
</signer>
</signers>
</recipient>
</recipients>
</inlineTemplate>
</inlineTemplates>
</compositeTemplate>
</compositeTemplates>
</envelopeDefinition>
Larry K
  • 47,808
  • 15
  • 87
  • 140
Todd
  • 459
  • 5
  • 18

1 Answers1

1

First, I'm not sure that it's possible to use Composite Templates and also specify a templateId and templateRoles at the top-level of the request (i.e., outside of the compositeTemplates collection). So, my first suggestion would be to modify your request such that all templates (including your first one) are specified within the compositeTemplates collection.

Next, I suspect that the reason none of the tabs are visible within the documents represented by the templates you're referencing in the compositeTemplates collection is that you're not supplying recipient information for each template. As you mentioned in your 'EDIT', this should be accomplished by using an inlineTemplate within each compositeTemplate item. For example, the following request using an InlineTemplate to supply recipient information for the Signer1 role and the Cc1 role that the Server Template defines.

POST https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes

<envelopeDefinition xmlns="http://www.docusign.com/restapi">
   <accountId>ACCOUNT_ID</accountId>
   <status>sent</status>
   <compositeTemplates>
    <compositeTemplate>
        <serverTemplates>
            <serverTemplate>
                <sequence>1</sequence>
              <templateId>3C9D42D3-3E76-4669-861E-9670415E1AD3</templateId>
            </serverTemplate>
        </serverTemplates>
        <inlineTemplates>
            <inlineTemplate>
                <sequence>2</sequence>
                <recipients>
                  <signers>
                    <signer>
                     <email>johnsemail@outlook.com</email>
                     <name>John Doe</name>
                     <recipientId>1</recipientId>
                     <roleName>Signer1</roleName>
                    </signer>
                  </signers>
                  <carbonCopies>
                    <carbonCopy>
                      <email>janesemail@outlook.com</email>
                      <name>Jane Doe</name>
                      <recipientId>2</recipientId>
                      <roleName>Cc1</roleName>
                    </carbonCopy>
                  </carbonCopies>
               </recipients>
            </inlineTemplate>
        </inlineTemplates>
    </compositeTemplate>
  </compositeTemplates>
</envelopeDefinition>

If you update your request to include recipient information for each compositeTemplate item (by using inlineTemplates like I've shown above), I'd suspect that the tabs within the template documents should be assigned to the appropriate recipients (per the information you supply within each inlineTemplate).

RE "EDIT 2":

Regarding the XML you posted in your question under "EDIT 2", remove the recipent tags that I've highlighted here -- doing so should result in a valid request that creates the Envelope using the specified Template(s) and assigns the tags appropriately to the recipients you specify in the request.

enter image description here

Kim Brandl
  • 13,125
  • 2
  • 16
  • 21
  • Thanks for the response. I actually tried this initially and kept getting INVALID_REQUEST_BODY (no other specifics). I noticed that you increment the sequence # in the first inline template---I have used the same sequence number for the inline template that I do for its server template. Does the sequence number denote the object sequence within a composite template? – Todd Nov 18 '13 at 20:47
  • That's correct -- i.e., the sequence number should denote the object sequence within the scope of the current composite template. That being said though, using the same sequence number doesn't cause the INVALID_REQUEST_BODY error, at least not in my tests. That error usually means that the contents/structure of the request is missing something that's required or includes something that isn't recognized. If you can update your post to add the full request that gives you this error, perhaps I can provide feedback. – Kim Brandl Nov 18 '13 at 21:45
  • I've updated my answer to include feedback about your "EDIT 2". – Kim Brandl Nov 18 '13 at 22:18
  • BINGO! That did the trick. I thought I needed to encapsulate the signers in a single recipient object. I appreciate your help again! – Todd Nov 18 '13 at 22:24