如何通过DocuSign UI添加文档元数据?

时间:2018-03-22 14:29:42

标签: docusignapi

我可以像通过API一样在文档级别添加隐藏的元数据吗?在DocuSign API中,我可以在文档对象中执行以下操作:

    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"
            }
        }
    };

DocumentFields指定 文档是什么。通过API,我可以检索文档及其字段:

EnvelopeDocumentsResult docList = envApi.ListDocuments(_accountId, envelopeId);
DocumentFieldsInformation docInfo = envApi.ListDocumentFields(_accountId, envelopeId, document.DocumentId);

由于我知道返回的文档是什么,我现在可以在其上运行业务逻辑。我想让用户能够在UI中执行类似的操作。这将允许API检索源自代码的信封,但代码仍然知道如何处理该类型的文档。

我尝试了以下内容:

  1. 我创建了一个“文档自定义字段”。
  2. “文档自定义字段”的类型为“下拉列表”,包含各种已知文档类型。
  3. 我修改自定义字段,使其为白色且只读(签名者将无法修改它)。
  4. 在发送信封/文档之前,我将此自定义字段添加到表单并选择正确的文档类型。
  5. 我发送文件。
  6. 当我运行相同的API方法来检索“文档字段”时,不会返回该值。看起来手动将字段放在文档上会导致该字段成为“表单”的一部分而不是元数据。

1 个答案:

答案 0 :(得分:1)

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.