Search code examples
javasdkdocusignapi

Docusign API - envelopeCustomMetadata is null when check enveloppe status


I create an enveloppe with Docusign Java SDK with some key paired values in the envelopeCustomMetadata property.

    
private void addMetadata( EnvelopeDefinition envelopeDefinition, String appId, String externalRef, String tenantId)
{
        metadata.addEnvelopeCustomMetadataDetailsItem(new NameValue().name(METADATA_APPLICATION_ID).value(appId));
        metadata.addEnvelopeCustomMetadataDetailsItem(new NameValue().name(METADATA_EXTERNALREF).value(externalRef));
        metadata.addEnvelopeCustomMetadataDetailsItem(new NameValue().name(METADATA_TENANT_ID).value(tenantId));

        envelopeDefinition.setEnvelopeCustomMetadata(metadata);
}

I send the request, all is fine. But when I check the enveloppe status, the envelopeCustomMetadata is always null. Is there a special enveloppeOption to set ? I don't want cutomFields.

I've tried with enveloppeOption and differents includes (documents, extensions, recipients, tabs, ...) as noted in the documentation. I've also tried to retrieve with Postman, I've the same...


Solution

  • Anything in the SDK that ends with "MetaData" is not actual part of the eSign API. It's an SDK element meant to help you, but in this case it's confusing you.

    What you want to do is add metadata to envelope, and you do that with custom fields.

    These endpoints are in the CustomFields object.

    CustomFields customFields = new CustomFields();
    // add custom fields as you need
    envelopeDefinition.setCustomFields(customFields);