Search code examples
docusignapi

List all the envelopes created from a template in DocuSign


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?


Solution

  • 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.