3

I have a pretty basic question about how the Docusign API works. I tried finding the answer myself but was quickly overwhelmed by the massive amount of information, much of which is outdated, in the support center.

Here’s what I’m trying to do:

  1. I have uploaded and configured multiple templates in my Docusign account

  2. I am writing a web app which will allow my users to request a subset of those templates based on certain criteria

  3. The subset of templates would then be used in my app via an iframe integration (I'm assuming)

  4. I would also like to automatically populate several of the fields in my new copies of the templates

How do I perform the API request in step 2?

How do I perform the API call in step 3? Or are the values injected into the document some other way?

A totally different approach would be to provision a new Docusign account for each of my users but that didn’t seem right. If someone could just point me in there right direction I would really appreciate it.

Ergin
  • 9,254
  • 1
  • 19
  • 28
wusauarus
  • 305
  • 4
  • 12
  • When you say support center which site are you referring to? Is that the DocuSign Developer Center? And which material is outdated? – Ergin Apr 21 '16 at 22:41
  • Yes I was referring to the DocuSign Developer Center. The material I was referring to is in the videos and screenshots throughout the site. Many of which refers to what appears to be DocuSign's old UI (dubbed DocuSign Classic it seems?). Here's a really basic example: https://support.docusign.com/articles/How-do-I-log-in-to-and-access-my-DocuSign-account – wusauarus Apr 23 '16 at 16:41
  • To be fair though, the documentation is vast and well written. I'm just feeling a bit overwhelmed because there is so much of it. Your answer has saved me and my team hours of research, so thank you for that – wusauarus Apr 23 '16 at 16:46

1 Answers1

3

It's actually not that basic of a question, I'd say if you were asking how to send a signature request on a document or from one template that's basic but how to combine and send multiple templates and populate values in them is a little more involved.

With that said, to combine multiple templates into signature requests you can simply use the Composite Templates node in your envelope definition. Using composite templates you can combine multiple server-side templates from your account, or combine templates with local documents or documents from other sources (i.e. cloud).

Regarding your Questions:

1]

You can make an API call to programmatically retrieve the templates that are available in your account then display whatever aspects you want about them in your UI, such as name, description, template ID, etc. Once the user (or your app logic) indicates which templates they want to combine into a signature request you can combine them like this (this combines 2 server templates):

{  
    "emailSubject":"DocuSign Signature Request using Composite Templates",
    "status":"sent",
    "compositeTemplates":[  
        {  
            "serverTemplates":[  
                {  
                    "sequence":"1",
                    "templateId":"55A80182-2E9F-435D-9B16-FD1E1C0F9D74"
                }
            ],
            "inlineTemplates":[  
                {  
                    "sequence":"1",
                    "recipients":{  
                        "signers":[  
                            {  
                                "name":"John Doe",
                                "email":"firstrecipient@gmail.com",
                                "recipientId":"1",
                                "clientUserId":"1001",
                                "roleName":"RoleOne"
                            }
                        ]
                    }
                }
            ]
        },
        {  
            "serverTemplates":[  
                {  
                    "sequence":"2",
                    "templateId":"44D9E888-3D86-4186-8EE9-7071BC87A0DA"
                }
            ],
            "inlineTemplates":[  
                {  
                    "sequence":"2",
                    "recipients":{  
                        "signers":[  
                            {  
                                "name":"Jane Doe",
                                "email":"secondrecipient@gmail.com",
                                "recipientId":"1",
                                "clientUserId":"1002",
                                "roleName":"RoleOne"
                            }
                        ]
                    }
                }
            ]
        }
    ]
}

2]

Yes if you want to embed your recipients (which means they sign through your UI and not through the DocuSign website or app) then it is recommended you use an iFrame for Web apps and a Webview for mobile apps. To embed a given recipient you must set their clientUserId as I have for both recipients in the above example. This is a string and is defined on the client-side, you just need to remember which values you use for each recipient as you need that to generate each recipient's signing URL (which you will load in the iFrame).

Have a look at the "Signing from within your app" API Recipe for sample code of how to accomplish this. That sample doesn't use templates to create the envelope but it shows how to generate the unique signing URLs:

Signing from within your app

Or if you want to test with raw API calls (that don't use the DocuSign SDKs) you can use the API Explorer to test these calls:

API Explorer

3]

You basically had a third question I think which was how to populate the tabs (aka document fields) in the template. You can identify a given tab by its tabLabel and populate it's value using the value property. For instance, if you had two tabs of type textTab (called Data fields in the UI) you can populate their values like this:

{
    "email": "jane.doe@email.com",
    "name": "Jane Doe",
    "roleName": "RoleOne",
    "recipientId": "1",
    "clientUserId": "1001",
    "tabs": {
        "textTabs": [
            {
                "tabLabel": "ApplicantAddress",
                "value": "221 Main St. Suite 1000 San Francisco, CA 94105"
            },
            {
                "tabLabel": "ApplicantSSN",
                "value": "12-345-6789"
            }
        ]
    }
}
Ergin
  • 9,254
  • 1
  • 19
  • 28