Document Tagging Scenario - Example showing how to collect metadata for DMS archiving
- 1 The document tagging story
- 1.1 Application Flow – Tagging
- 1.2 Recipients Page
- 1.3 Designer Page
- 1.4 Summary Page
- 1.5 Authorization Request
- 1.6 Custom Tagging Page
- 1.6.1 Serverside handling of Form Data
- 1.6.1.1 Update Metadata in Draft
- 1.6.1.1.1 POST body
- 1.6.1.2 Send Envelope
- 1.6.1.2.1 POST body
- 1.6.1.1 Update Metadata in Draft
- 1.6.1 Serverside handling of Form Data
- 1.7 Document Inbox
- 1.8 Application Flow – Callback Handler
- 1.9 Sample Implementation of the OAuth2 Code Grant Flow for the Tagging Scenario
The document tagging story
You want to save your files and find them again straight away? With DMS tagging you can add metadata so that you can save your documents and envelopes with additional data and thus you can more easily assign and find them.
The DMS Tagging integration scenario explains how to integrate a custom tagging page (e.g. aligned with the data structures from your DMS / ECM) into eSignAnyWhere, and how to use this data for later upload (with tagging) to the DMS/ECM solution.
In the eSignAnyWhere Web UI, an additional (custom) page is added before sending the envelope. This page collects tagging information. The data are stored in the envelope’s metadata section. A callback handler service implementation is notified after envelope completion, and will extract the tagging information from the metadata and perform the upload to the DMS.
This story includes the following:
Use of a custom page implemented in an external service on integration layer, used to do tagging of the envelope for further use of the DMS
Callback handler process completed envelopes and store the results in the DMS
We recommend to read the story "Retrieving the User API Token via OAuth" before continuing with this story.
Application Flow – Tagging
You can define the envelope as usual, with the eSignAnyWhere WebUI envelope creater. After the recipients page and the designer page, the sender will see the summary page of eSignAnyWhere. In the summary page, instead of the “SEND” button, the sender will see a “NEXT” button because a “before-send redirect url” was configured.
Following placeholders are available for the “before-send redirect url” :
##EnvelopeId##
##SenderUserId##
##OrganizationId##
When the sender clicks the “NEXT” button on the summary page, he/she is redirected to the configured before-send redirect page. This page, for example can allow to modify the envelope before sending. Therefore, the page is collecting the DMS Tagging metadata in a custom HTML form, and will set the data as metaDataXML into the envelope. On the authorization page, the OAuth 2.0 code grant flow is implemented, and therefore the user is asked, if not permissions have been granted for the application so far, to authenticate and grant permission for the custom web application to access the API. After successful authorization, the user is redirected back to the custom web application for the document tagging.
After he/she enters the data, the form action is calling the custom web application’s back-end with the form data provided. The back-end will update the envelope (draft) data by adding the metadata, and will the send the envelope based on the draft. Afterwards, the user is redirected to the eSignAnyWhere documents inbox.
The next figure shows the process flow in detail:
This flow will be represented to the user in the following screens:
Recipients Page
In the recipients page, the sender selects documents to be signed, and defines the recipients and workflow. This is standard eSignAnyWhere functionality.
Designer Page
In the designer page, the sender may define or add form fields, signature fields and predefined annotation fields. This is standard eSignAnyWhere functionality.
Summary Page
In the summary page, the sender may adjust some envelope settings such as notifications/reminders.
Authorization Request
Then the user is redirected to the configured redirect page. Before the tagging page is shown, the user may be asked to login (which is usually skipped because the user’s session is already active), and on first usage the app asks for permissions to grant API access. Details of this authentication are well described in the story "Retrieving the User API Token via OAuth".
Custom Tagging Page
This page is fully implemented in the custom web application for DMS tagging. The fact that it looks like the eSignAnyWhere Web UI is just because it was implemented that in a sample code. This is purely part of the custom DMS tagging sample.
In a simple webform, this can look like:
Serverside handling of Form Data
After clicking the "Send Envelope" button in the custom tagging page, notify the backend of the tagging page implementation (also called "BeforeSendRedirectPage") and let the backend do the following with the retrieved form data:
Update Metadata in Draft
Set the data collected via the form e.g. in draft metadata section, to make these data available for the later callback processing
This will make the data available for pushing the signed documents to the document management system (DMS)
POST /v6/draft/update
POST body
{
"DraftId": "...",
"MetaData": "..."
}Send Envelope
While being on the BeforeSendRedirectPage, we are still working on a draft. There was no envelope sent yet. To send the envelope, we use an API method for the transition from draft to envelope:
POST /v6/draft/send
POST body
{
"DraftId": "..."
}