Reputation: 494
Can I add hidden metadata on the document level like you can through the API? In the DocuSign API, I can do the following in the document object:
new Document()
{
DocumentId = (i+1).ToString(),
DocumentBase64 = Convert.ToBase64String(request.Documents[i].Stream.ReadAsBytes()),
Name = request.Documents[i].Name,
DocumentFields = new List<NameValue>()
{
new NameValue()
{
Name = "DocumentType",
Value = "ElectronicConsent"
}
}
};
The DocumentFields
specifies what that document is. Through the API, I can retrieve the document and its field:
EnvelopeDocumentsResult docList = envApi.ListDocuments(_accountId, envelopeId);
DocumentFieldsInformation docInfo = envApi.ListDocumentFields(_accountId, envelopeId, document.DocumentId);
Since I know what the returned document is, I can now run business logic on it. I'd like to allow users the ability to perform a similar action in the UI. This would allow the API to retrieve an envelope that did not originate in code, but the code still knows how to handle that type of document.
I tried the following:
When I run the same API method to retrieve "Document Fields," the value doesn't get returned. It appears that manually placing the field on the document results in the field being part of the "form" instead of metadata.
Upvotes: 0
Views: 593
Reputation: 6818
You cannot set Document Field as you can set it in an API. The Document Custom Field which you are setting is just another reusable DocuSign tab. So on WEBApp if you are planning to use Document Custom Fields, then your Connect listener should check for two things, one document fields which will be coming from the API, and the Document Custom Field which will be coming as form data. When doing through WebApp, I will make that field white label on white text so that it is not visible to the customer, but it is present on the document. To make maintenance easier on your side, I would create two Connect listener, one just for API user who will be using Document Field, another for non-API/WebApp user who will be using these reusable Document Custom Fields, and write different logic on both listener.
Upvotes: 1