Landy Cuadra
Landy Cuadra

Reputation: 165

How can I retrieved completed envelopes filtered by template Id?

I am retrieving all the completed envelopes, but they are from different template, is there a way to filter the retrieve, to get only the envelopes that match with a template id?

here is how a retrieve the envelopes:

            dsApi = new docusign.ApiClient();
            console.log("ACCESS TOKEN => " + token);
            // Set headers
            dsApi.setBasePath(data[0].config.docusign_base_uri);
            dsApi.addDefaultHeader('Authorization', 'Bearer ' + token);
            let envelopesApi = new docusign.EnvelopesApi(dsApi)
            , results = null, resultsTemplate = null,
            options = {fromDate: fromDate_in, toDate: toDate_in, status: status_in};
            try{
                results = await envelopesApi.listStatusChanges(data[0].config.docusign_account_id, options);
            }catch(error){
                response = { code: "400", message: error };
                console.log("RES: " + JSON.stringify(response));
                res.send(response);
            }

Upvotes: 0

Views: 149

Answers (1)

Inbar Gazit
Inbar Gazit

Reputation: 14015

I don't believe this can be done using the API without some extra work on your part. The reason is that the envelope, once created, as no affiliation with the original template from which it was created. The template is used to get all the information into the envelope, but at that point it's like any other envelope. You could set up some custom fields that are different for each template. You could set up different folders for the different templates. You can search on many other things that are part of the end envelope (not the template) and while it does require additional setup work, it will enable your scenario.

Upvotes: 1

Related Questions