List all the envelopes created from a template in DocuSign - docusignapi

I'm trying to get the list of all the envelopes created from a specific template in java.
EnvelopeTemplateResults envTempResults = templatesApi.listTemplates(accountId);
I can get the list of all the templates in the account by iterating through envTempResults and calling the method getTemplateId(). Is there a way for me to get the envelopes created from these templates?
Alternatively, is there a way to get all the bulk envelopes sent out (specifically I want to get all the Batch IDs) or a list of all the envelopes in the account?

An envelope and a template are the same thing conceptually, they are both a set of documents, recipients and fields.
The only difference is that you take a template and use it as a "boilerplate", which basically means you duplicate/copy the template into an envelope.
From that point on the envelope lives in the system independently, and there's no direct means to track what template was used to create it.
The solution that most customers/developers found is to use unique values or characteristics of the template/envelope to find out. It can be anything, from the type/number of recipients or documents, to the location of tags etc.
The best way to do it is by using metatdata, or custom fields. These are copied (just like everything else is copied) and you can add one called "templateName" which will always have the templateName in it and then you can use that to find the list of envelopes created from this template.
https://www.docusign.com/blog/developers/the-trenches-track-your-templates-envelope-custom-fields Shows you how to do that.
However, if you want to do this, it will only work for envelopes created from that point onwards. It will not be possible to search for envelopes created from the templates before you added the custom fields to them.

Related

Can I use auto place anchor strings in DocuSign with Document Visibility on?

I have a working application where a generic document is defined in the DocuSign template with auto-place anchor strings. In creating the envelope I replace the generic document with a document generated by my application.
A new requirement is to have multiple documents in the template with document visibility turned on so as to control recipients only seeing certain documents.
I have successfully created envelopes replacing the multiple documents with my generated documents using composite templates.
The problem I'm having is with using auto-place anchors. I either receive a response from the API that anchors must be specifically placed on the document or when the recipient receives the document, the process repeatedly loops thru the anchors and never allows the recipient to finish the signing of the document.
The question is can I use auto-place anchors with document visibility?
The documents I am generating are the same as in the template, but now have been populated with customer information that may change the location of where a signature is needed
I suggest you try with multiple composite template, each with 1 document.
See my article for more template ideas.

Is it possible to conditionally display DocuSign template parts/sections?

I would like to know if it is possible to show/hide parts of DocuSign document template depending on the data which is passed in as a request.
I already have document template created and uploaded to DocuSign. I then use templateId to create envelope for that document and I also send some data (as json) to prepopulate certain fields inside the envelope.
The thing I am asking now is:
If the template has, let's say, 3 paragraphs, is it possible to hide one of them completely, based on the passed in json data?
Creating and uploading multiple templates is not an option due to large number of conditionally displayed sections.
I have been reading DocuSign API documentation, but couldn't find an answer to this.
To do that you will have to use Responsive Signing.
This feature change the format of the document you sign from PDF to HTML.
With HTML being the format, there are a lot more things you can do.
For example, you can use what we call "Smart Sections" which is exactly what you want. Sections that can be shown off/on based on logic you set.
Find out more about the responsive signing API here - https://developers.docusign.com/esign-rest-api/guides/responsive-signing/api-overview

Using Docusign REST API to attach document to SignerAttachmentTab

We have defined a template that will be filled in and signed by our customers. In this template we have some fields that we pre-populate along with some documents that we will attach. The customer will fill in other fields and attach more documents. We are using the REST API to generate the sign request. We are able to generate the correct REST request to fill the tabs in the template, set the recipients and successfully send the signature request. All this works great. But now we're trying to get a document attached to the appropriate SignerAttachmentTab in the template and we cannot get REST to accept it.
We've tried using the Documents field but that doesn't work with templates it seems. We created a composite template and then defined a document for the document, server template for the template itself and an inline template to contain the tab data we want to populate. This keeps generating errors about the tab page number not being right. We've tried different values and we've looked over all the forum posts and documentation related to attaching documents to templates and none of them seem to work.
For the document we specify the file to upload, set the document ID and name. In the server template we specify the template ID. In the inline template we create a recipient, set their information, build up the envelope tabs with the data and then add a SignerAttachmentTab for the document. In this tab we set the document ID to match the document ID from the Document element. We set the tabLabel to the label used in the template itself. We've tried setting pagenumber but that doesn't change anything. All we want is for the document to be sent to the customer. When the open it they can double click the attachment field and view the document we're trying to send.
I'm trying to use the recipe explorer to get this to work using raw REST and it keeps failing with the TAB_PAGENUMBER_IS_NOT_IN_DOCUMENT error. It seems like the document is taking precedence over the template. Unfortunately I cannot change the order of the templates in the editor other than setting the sequence # on the server and inline templates. Here's the request that is generated using DocuSign's test system.
{
"compositeTemplates":[{
"document": {
"documentBase64":"<Base64BytesHere>",
"documentId":"2",
"name":"Test.pdf"
},
"inlineTemplates":[{
"recipients":{
"signers":[{
"email":"abc#def.org",
"name":"Person",
"recipientId":"1",
"roleName":"Sender 1",
"tabs":{
"signerAttachmentTabs":[{
"documentId":"2",
"tabLabel":"MyAttachment"
}],
"textTabs":[{
"tabLabel":"someText",
"value":"Value1" }
]}
}]},
"sequence":"2"
}],
"serverTemplates":[{
"sequence":"1",
"templateId":"guid}]
}],
"emailBlurb":"A message",
"emailSubject":"Test",
"status":"sent"
}
I've looked at the existing posts in the forums and either they don't work for my case or they aren't trying to actually attach the documents to the template but simply include them as a document in addition to the template.
Update
Re:
...associate [a] document to the tab so that the signer will be able to click the attachment field in the document and see the document
Yes, you can now do this by using Smart Sections with a documentHtmlDisplaySettings object in the Envelopes:create request. The collapsed (or collapsible) section can be displayed in different ways:
inline
collapsible
collapsed
continue_button
responsive_table
responsive_table_single_column
print_only
Live examples that you can try online
HTML source document
Word source document
Original answer
Re:
But now we're trying to get a document attached to the appropriate SignerAttachmentTab in the template and we cannot get REST to accept it.
You're trying to use the API to add a document to a SignerAttachmentTab?
This is not supported. Only signers themselves add documents to a SignerAttachmentTab. The API can't do it for them.
Is the issue that you want to make sure that a signer attaches (uploads) a document to the envelope as part of the signing ceremony? You can make the tab non-optional (required). But that won't check the contents of the attached file.
You could use a web hook / Connect to check the file(s) that were attached and, if the right files weren't attached, generate another enveloper for the signer.
I figured out what I was doing wrong. For a template without attachments I was using TemplateRole and EnvelopeTabs. But for attachments, trying to include any document would cause the document to override the template. So I switched to composite template with server and inline templates for the template and data. Trying to add documents in various combinations in the various areas where they are allowed generally caused the request to be sent but with no documents.
The final solution was to go back to the original TemplateRole approach but to create the envelope as a draft. After the draft envelope was created I could then add the document to the envelope. But unfortunately to send the envelope you then have to reattach the recipients. I'm looking to clean that up but otherwise it is working for me now.

Docusign API - Inserting new pages on documents created using templates

I am trying to create envelope using templates. I have a unique use case where I would need to repeat one of the pages on the template based on the user input upfront before generating the docusign envelope to sign.
My template-1 has 12 pages with sign tab on 12th page. Based on user input I might have to include multiple page#4 and multiple pag#10 in between at the time of envelope creation. So my final docusign document for signature will be having pages 1,2,...4, 4a, 4b, 5, ........9, 10, 10a, 10b, 1oc, 11,12.
One suggestion I got was to use composite templates and have the pages added on the fly. But my question is, then wouldn't that require my template-1 to be broken down into multiple templates based off where new pages need to be inserted? Is there any other way I can achieve this, as I might end up having quite a bunch of split templates out of a single template.

Adding additional pages to envelope created from a template

Is it possible to add extra pages to the middle of the document on envelope created and ready to send from a set template.
Use case:
Using DocuSign UI, Template-Sample saved with 4 pages, signing tab at the end of 4th page
Using API on code, envelope is created with the Template-Sample
Add 1 or more pages (with data contents) after 3rd page on template
Send for signing.
Yes. While the envelope is in the Created status (draft), it is no problem to change the envelope's contents.
Changing a specific document within the envelope is only supported by changing the entire document. That's possible, but the easier way is to have a series of separate documents in the envelope, and then only insert the new document.
Eg, if you still want the signing page at the end of all the pages, you'd have three documents:
The front matter document
The document that you're changing on the fly
The final document, including the signature page
Doing this sort of document manipulation usually involves the use of composite templates. Please ask additional questions if you'd like more help.

Resources