Docusign - Populate tabs in envelope using REST API - docusignapi

I have created a template in DocuSign with a number of fields. I have also built an application that creates an envelope from that template and sends it using the REST API.
In that process I also would like to prepopulate those fields in the envelope document before sending to the first recipient. For achieving this I have looked at the update method for recipient tabs (https://developers.docusign.com/esign-rest-api/reference/Envelopes/EnvelopeRecipientTabs/update)
However when using the update method I need to have the tabId which is unique for each envelope. If I have 20 tabs in a document I have to fetch them all for getting the ID before doing an update. Is there a better way of doing this?

The API must be able to determine the unique tab you wish to update, so a unique ID of some sort is required to do so. Note also tabs are for a specific recipient and you need to specify the page number as well.

Related

DocuSign - Custom Fields without Recipients

How to create custom fields that have no link to recipients? Would it be prefill tools? the only option I found but it asks for recipientId and when I give a Get we don't have this information.
It depends on what you are trying to do:
If you are trying to add metadata to the envelope, but not change the way to documents look (meaning, the data is not imprinted on the documents for recipients to see), then you can use envelope custom fields. Those could be set via the web app or via API.
If, on the other hand, you want something to be visible to recipients, meaning, you want a change to the way to documents look and you don't want that to be associated with a recipient, then you need pre-fill fields. These can also be set via API, see this blog post.

DocuSign Recipient and Custom Fields

I am new to DocuSign technology and need to get few pointers.
I have tested some java API to send emails out thru Docusign and did my homework. Few questions:
Can I create a DocuSign Template without a Recipient? DocuSign is not letting me to add custom fields without a recipient.
My use case is: Put a template on docusign with some custom fields (say 10). My application would pass values for 3 custom fields along with new recipient (email address). I expect recipient would fill rest of custom fields.
How can I create/send an envelope with a Template ID and Recipients? I see error that you can pass only one of them.
I am able to pass values to custom fields via EnvelopeDifinition->TemplateRole->Tabs->TexTabs. But, the values are not populated if there are multiple recipients.
I am looking at some guidance on the approach for my use case and some pseudo code if that helps.
Thanks
You cannot create a template without recipients, because you cannot create an envelope without recipients. At least one is required. A template is a repetitive envelope and if it were created without recipients - you can have an envelope without recipients which is not allowed.
There are two types of recipients in templates. The one you probably need is a role based (templateRole) that does not include the email/name but has to be provided when an envelope is created from the template (also called placeholder). That recipient can still have fields (tabs, tags) and the API can provide the value for some of them.
This article talks about how to set the values of tabs in an envelope created from a template and is exactly what you're saying you want to do.

Ability to modify template tabs to have values in an envelope when a template is applied to an envelope

I am using docusign APIs to use an existing template when i send an envelope. In the Envelope definition (env), using env.setTemplateId(), i am able to set the template to the envelope. I want to be able to edit the tabs (to make them read-only and populate values) added through the template only in the context of the envelope (without modifying the template).
But on trying to retreive the envelope contents, the tabs are not listed as part of the envelope.
Any pointers on this?
Have seen a few similar questions (Docusign API - prefilling tab values on envelope created from template, Docusign API - prefilling tab values on envelope created from template), but no concrete solution yet.
By default GET on an envelope would not retrieve the tabs. You can do that by making this API call:
GET /restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}/tabs
Which requires that you know the documentID.
If you are using one of our SDKs, you can see code examples that do just that here:
https://developers.docusign.com/esign-rest-api/code-examples/set-template-tab-values

Creating envelopes where first signer specifies next recipient(s)

I need to send out a document / envelope. I'm using the C# SDK, since we'll be sending from a service. We know who the recipients of the document COULD be, but it's up to the first recipient to either sign or choose a recipient.
The first recipient of the document can do one of two things-
Sign the document
select a different recipient from a drop-down list of Roles, and then have the document go to that user for their signature.
these future roles are "Dealer" and "Lawyer". We'll know, at the time of
selection who these user's are (names & emails).
Right now, I have a template (from Word), with tabs that will be populated when sending the initial envelope, so that all users can see the data.
My question(s) are:
Is using the Template the best option? Should I attempt to update the text within the Word document, by not having it configured as a template?
How should I add the users / roles / signers to the envelope, since they can be chosen ? I saw something about Intermediaries - is this what I should be using to specify the next recipient in the document? Currently, I have three "Roles" defined in my template- one for "Provider" - the first recipient, then "Dealer" and "Lawyer".
IF not using a Template, how should I specify / add the follow-up users, "Dealer" and "Lawyer"?
Any assistance is greatly appreciated!
Using a template is probably what you need. You can update the document inside a template before sending an envelope that is created from the template. (you can also use"correct" to update an envelope that was sent, but only by the original sender and there are some other limitations)
see comment from Drew, you cannot do a conditional recipient yet, but there are other options, including a special type of recipient that can add other recipients (if that's what you want).
You can create a more complex workflow that have the first envelope trigger a second envelope with the recipients you want. That could work for you. Not sure yet about all your requirements, but the first signer can trigger this using our web-hook from connect.

Unable to Apply Multiple Templates to a Single Document in a DocuSign Envelope using CreateEnvelopeFromTemplates

I have been successfully using DocuSign embedded signing in a J2EE application, using the createEnvelopeFromTemplates SOAP API, 1 template and 1 document to create 1 document in an envelope for 2 signers.
Now I am implementing a case with more than two signers. There are some checkboxes contained within the document. The chechboxes are to be checked by one of the signers. Not all signers sign each document, and which signer checks the checkboxes is determined at envelope creation time, based on which signers are actually present.
I tried to implement this case by using a set of templates with:
One template for all the possible signatures
Templates tagged for each possible signer that could fill in the checkboxes.
At envelope creation time, my website has collected the information to know which signers are present, and which signer will fill in the checkboxes. The appropriate templates are referenced in the call to DocuSign to create the envelope, and the appropriate roles are assigned. The problem is that when specifying multiple templates with the createEnvelopeFromTemplates operation, each TemplateReference object requires a document. I can't figure out how to tell the API to apply the multiple templates to the same document, so I will end up with a single document in the envelope.
Reading the DocuSign documentation, it appears that using createEnvelopesFromTemplatesAndForms with CompositeTemplates might work, but I would prefer to stay with the simpler CreateEnvelopeFromTemplates. Is there a way to apply multiple templates to a single document using CreateEnvelopeFromTemplates?
Thanks, Mark
You will need to use CompositeTemplates to solve this. The CreateEnvelopeFromTemplates() call that you are making adds what are known as ServerTemplates to your envelope, and since each server template contains a document (i.e. you can't save a design-time template in the DocuSign Console without providing a document) each time you add a server template to an envelope it adds the document too.
Using CompositeTemplates you can add ServerTemplates as well as InlineTemplates to your envelopes which means you can start with the template with the document(s) then use the properties of a second (inline) template without including its documents. Therefore, the SOAP call you should instead make is
CreateEnvelopeFromTemplatesAndForms()
And using the RoleName property you can assign your recipients to the template roles you have already created at design-time.
I was going to suggest testing this through the API Explorer but remembered you're using the SOAP API not REST and that's for testing with REST, so instead probably your best bet is the SOAP documentation and the samples found in the SOAP SDK on GithUb:
DocuSign SOAP SDK
SOAP Guide - CreateEnvelopeFromTemplatesAndForms
There are sample CreateEnvelopeFromTemplatesAndForms() calls in the SDK that show how to make the call.
We have found a solution that seems to work. We are still using the CreateEnvelopeFromTemplates operation, but we combined our templates into one and have a created a new role, "Question Answerer", and assigned all the checkboxes to that role. At envelope creation time, when we specify the role assignments, we specify the ID of the appropriate signer to both the signature role and the "Question Answerer" role.
Although we did not find a way to apply multiple templates to a single document using CreateEnvelopeFromTemplates, the above solution solves our problem.
Thanks, Mark

Resources