Custom document metadata when using DocuSign REST API - docusignapi

Is there a way that I can provide any custom document metadata when adding documents to my DocuSign envelopes when using the REST API?
DocuSign appear to enforce the use of a positive integer for the DocumentId's we provide in the envelope. Whilst we are indeed using a positive integer, sometimes, there is some additional info that we need to supply, which we would like to come back in the DocuSign webhook events for specific documents.
I've had a look at the Document object but can't see anything obvious that I could use. An example would be simply providing a true/false along with a specific document, which I can inspect when I receive the DS webhook events.
At the moment, the only workaround I can think of is to add an Envelope Custom Field which contains any of my DocumentId's where 'true' is applicable, which feels like a bit of a shoddy solution, and I don't know if there's a character limit in those Envelope Custom Fields, which could break such a workaround.

Custom envelope text fields give you complete flexibility on providing meta-data that you can get back from the webhook. Here is some information about this:
This is how you create a custom field for an envelope:
https://developers.docusign.com/docs/esign-rest-api/reference/Envelopes/EnvelopeCustomFields/create/
This article shows code examples in 7 languagues on how to get the custom fields values :
https://developers.docusign.com/docs/esign-rest-api/how-to/get-envelope-custom-field-values/

Related

DocuSign what are the special fields I can add to Word documents to use via the API

I am testing the Docusign API and I can send a document to sign and get it signed in the position I want using the SignHere data structure and setting the AnchorString.
I want to add a field for the signed date but what is the format and field name required. I can't see anywhere that tells me how to type these into a Word document.
I see you can create templates online using Docusign and put in these fields but I don't see how that will work for us. The document will be dynamically created by our document assembly system and then sent via the Docusign API so I need to build in the fields at that point when I add the signature anchor string.
So what is the Word document special field format and list of Docusign available fields please?
Also it would be good to know how to insert a field to ask the signer to enter some text. Any entry box.
Thanks for any help.
If you're using Salesforce to send out these documents, the DocuSign CLM product supports template codes in Word. See docs.
Otherwise, you can only specify locations of fields (tabs) in the Word doc. This is done via anchor strings also known as auto-place fields. Docs.
Placing the anchor strings in your Word doc is the first step. For the second step, I recommend that you create a DocuSign template by using the DocuSign web tool. Then, when you send the document via the API, you combine it with the template. Or better, you can insert the Word document into the template itself.
The advantage of this technique is that your business users, with the right instructions, can update the template by themselves.
An alternative is for the DocuSign API request to specify the document and the various fields (tabs) that should be included in the document for the signers.
Added
Two other options:
Create your source documents as HTML documents. You can include special tags to indicate different types of DocuSign fields. You can also indicate sections of documents that can be expanded/closed by the signer. HTML field documentation.
This is the best approach, IMHO.
Create your source documents as PDF Forms with form fields. DocuSign can then transform the PDF form fields into DocuSign form fields. There are limitations. Docs.

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

download signed document as JSON from docusign

It seems that docusign only supports downloading the signed documents as PDF instead of JSON.
I need to 'read' the filled fields of the documents (the document has some fields to fill in).
I can upload the document as JSON and it gets parsed, so why can't I donwload it as JSON?
How do companies normally handle the field values?
Thanks!
You don't need the actual PDF document to get the values, you need to parse the call coming back from DocuSign since that has total envelope data. The webhooks for notification contains the data and you can parse that to retrieve the envelope data.
Do you know if its also possible with a GET call instead of the webhook? It could be the server is down etc, so I can't imagine DocuSign does have something like GET:envelope/:id/data or something.. But really cannot find anything like it
Yes. You can either use a GET call (included below) any time you want to get envelope data or you can set up the webhooks so that DocuSign will send you updates whenever it has one!
The following GET call retrieve envelope data from {{envelopeId}}. By parsing the response from the call you can retrieve all information that was filled on the envelope.
{{baseUrl}}/envelopes/{{envelopeId}}/recipients?include_tabs=true
I hope this helps.
P.S. Summarized our comments to have a complete answer.
The PDF format is, for lack of better words, a complicated jumble of compiled data that can be difficult to parse. What it appears docusign will do is take the data provided and fill the PDF document fields that are previously identified.
With docusign returning the PDF, you will need to parse the PDF input fields to receive the field values. There are several libraries that can be used to parse the various form fields and do what you would like. Check out:
https://www.npmjs.com/package/pdfreader
https://www.npmjs.com/package/pdf2json
I am sure there are more that would work for you as well if you look around if these don't work for you.

Docusign API, "Correct Document" or just change fields

Using the Docusign API, I am trying to change the fields that exist on a document. When I first create the document, I am able to change field values using "tabs." I get how to do that.
When I am trying to edit, or in Docusign's terms "correct," a document after it has been sent out, but before being signed, I am having trouble figuring out how to access those fields again to change the values.
I have tried using the API avenue described here ( PUT /v2/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}/fields ), but even after successful calls, the values of the fields aren't changing, and I believe it is because I should be trying to access the tabs, as I did when first changing the tab values as I created the document, instead of targeting the fields, since the two seem to be different. Any thoughts? Thank you in advance for your answers.
To update Tab values you should use the putRecipientTabs api.
Once a signer completes the Signing process, the tab values cannot be updated.
Also not all Tab values can be updated. See this answer for more information.
The putEnvelopeDocumentFields api is for a different purpose. Document fields are different from Tabs. Document fields are an array of name-value custom data strings to be added to a document. Custom document field information is returned in the status, but otherwise is not used by DocuSign.
I figured it out.
The "fields" we are seeing on documents are "tabs," and they are children of the recipients.
The hierarchy goes envelope > recipients > tabs, which tabs we were trying to change. Not envelope > document > fields, which refers to something else--just familiarizing with the language of the api.
Here is a link to the reference for how to change "fields" aka "tabs", and that link includes sample requests.
One thing that helped me target my actual fields, since I kept on getting an error that the field didn't exist for the recipient, is to do a get request of all available tabs and use that response body as the request body for the update call (where we change the field values). Then you know the field information will be accurate, paring the body down to exactly the "fields" aka "tabs" you are interested in targeting.

How to use DocuSign labels?

When sending a document to be signed, with DocuSign, I can choose a Document Label for the document with a dropdown list which I can manage administrative access. I don't, however, see the purpose of the Document Labels since I don't see any obvious way of using them to e.g. filter documents and create statistical reports. More information on the subject can be found here.
Can somebody describe to me the actual purpose of having these labels?
Here is screenshot of the Document Labels section:
Hmm, I agree the documentation you linked is missing some detailed information on what they are for. In Classic (and soon again to be in the New UI) they were called Envelope Custom Fields, from the old documentation they are classified as "fields that can be used to record information about the envelope, help search for envelopes and track information. The custom fields are shown in the Message window when a user is creating an envelope. The custom fields are not seen by the envelope recipients."
Think of it as an invisible label that you can than use to report on later. In the Reporting section of DocuSign it's actually called "Custom Field" and can be added to reports:
Envelope custom fields (Document Labels) are labels used to classify, record, and track information about envelopes sent by a user. These labels are shown to a sender when an envelope is being created; they are not seen by recipients.
The values for an envelope custom field can be free-text entries, or selected from a list of possible values. Envelope custom fields can be required or optional.
It is a metadata over envelopes. For instance, if you want to associate a case number or Invoice Number present in your system with an envelope but you do not want recipient to see it then you use Envelope custom fields (Document Labels) for this purpose. Then you can search envelope based on this label value in the Manage tab in your DocuSign Account. So Document Label helps in mapping data in your system with the envelopeId plus it helps you send extra data on an envelope which you do not want recipient to see.

Resources