# DOCUSIGNCHECK Workflow Application

## Overview

The **DOCUSIGNCHECK** workflow application lets you check the status of an envelope and download its associated file, which is a concatenation of attached files.

## How it works

* You can check the status of an envelope and download the file from DocuSign according to your status criteria.<br>
* Application logs are available. These can be specified by setting the value of the `DocuSignCheckLogLevel` parameter in the `web.config` file to `0` to deactivate logs, `1` for error logs, `2` for information logs, or `3` for debug logs; the default value is `0`.

## Required parameter

| **Parameter**          | **Type** | Direction | Description                   |
| ---------------------- | -------- | --------- | ----------------------------- |
| `DOCUSIGN_ENVELOPE_ID` | TEXT     | IN        | DocuSign envelope ID to check |

## Optional parameters

### DocuSign configuration

There are two ways to configure DocuSign account information: you can define the configuration in the `web.config` file or in the Configuration Panel, or you can manage the configuration on each DOCUSIGNCHECK action.

{% hint style="info" %}
These parameters must be associated to a DocuSign account.
{% endhint %}

{% hint style="warning" %}
It's necessary to have authorized your DocuSign application for use. To do this, go to the following address: `<SERVER>/oauth/auth?response_type=code&scope=signature%20impersonation&client_id=<CLIENT_ID>&redirect_uri=<REDIRECT_URI>`

* `<SERVER>`: `https://account.docusign.com` (production) or`https://account-d.docusign.com` (demo)
* `<CLIENT_ID>`: Corresponds to your DocuSign application's `Integration Key` value
* `<REDIRECT_URI>`: Redirect address (e.g.  `https://docusign.com`)
  {% endhint %}

| **Parameters**         | **Type** | Direction | Description                                                                                                                                                                                                                                                                                               |
| ---------------------- | -------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DOCUSIGN_CLIENT_ID`   | TEXT     | IN        | <p>DocuSign client ID<br><br>Corresponds to your DocuSign application's <code>Integration Key</code> value</p><p></p><p>By default, this value comes from the <code>DocuSignClientId</code> parameter in the <code>web.config</code>.</p>                                                                 |
| `DOCUSIGN_USER_GUID`   | TEXT     | IN        | <p>DocuSign user GUID<br><br>Corresponds to the value of <code>User ID</code> in the DocuSign configuration panel</p><p></p><p>By default, this value comes from the <code>DocuSignUserGuid</code> parameter in the <code>web.config</code>.</p>                                                          |
| `DOCUSIGN_AUTH_SERVER` | TEXT     | IN        | <p>DocuSign Auth server</p><p></p><p>DocuSign values:</p><ul><li><code>account.docusign.com</code> (production)</li><li><code>account-d.docusign.com</code> (demo)</li></ul><p>By default, this value comes from the <code>DocuSignAuthServer</code> parameter in the <code>web.config</code>.</p>        |
| `DOCUSIGN_RSA_KEY`     | TEXT     | IN        | <p>DocuSign RSA key<br><br>By default, this value come from the <code>/Files/DocuSign/rsaKey.pem</code> file.</p>                                                                                                                                                                                         |
| `DOCUSIGN_HOST_SERVER` | TEXT     | IN        | <p>DocuSign host server</p><p></p><p>DocuSign values:</p><ul><li><code><https://docusign.net></code> (production)</li><li><code><https://demo.docusign.net></code> (demo)</li></ul><p>By default, this value comes from the <code>DocuSignHostServer</code> parameter in the <code>web.config</code>.</p> |

### General

| **Parameters**      | **Type** | Direction | Description                                                                                                             |
| ------------------- | -------- | --------- | ----------------------------------------------------------------------------------------------------------------------- |
| `VALID_STATUS_LIST` | TEXT     | IN        | <p>Valid status to download the document<br><strong>Default:</strong> <code>signed,completed,voided,declined</code></p> |
| `DOCUSIGN_DOCUMENT` | FILE     | OUT       | DocuSign document                                                                                                       |
| `DOCUSIGN_STATUS`   | TEXT     | OUT       | Envelope status                                                                                                         |

## Example with DOCUSIGNSEND

In the following example, the [DOCUSIGNSEND](https://docs.workflowgen.com/admin/8.0/docusignsend-workflow-application) action is directly followed by the DOCUSIGNCHECK action. This action will loop back on itself until the status changes to `signed`, `completed`, `voided`, or `declined`.

If the status returned meets the condition, the document will be downloaded from DocuSign.

<div align="center"><img src="https://3810463125-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LQ0OuyalhD4eRB31PgV%2F-MVvmjrIre3XZqR36v0b%2F-MVwZMdeLKN5YmoFMRpm%2Fdocusigncheck_workflow.png?alt=media&#x26;token=e763aaf9-2173-4eb5-a500-c8778ec1c4c3" alt=""></div>

With the system loop action feature, the DOCUSIGNCHECK action will be executed every `x` seconds until the OUT condition is met.

<div align="center"><img src="https://3810463125-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LQ0OuyalhD4eRB31PgV%2F-MVXr7X44kSA03O1B4jw%2F-MVXydqavxgB4SVCxCMa%2Fimage.png?alt=media&#x26;token=fb1364d3-4876-4b08-a318-d71cf80a72a5" alt="Configuration of a DOCUSIGNCHECK action"></div>
