Los Morales
Los Morales

Reputation: 2155

DocuSign API Metadata in envelope

Using the C# SDK for requesting signatures to remote recipients. Was wondering if I could add metadata to the envelope itself, e.g. another id specific to our domain, that can be set once (initially) and be retrieved anytime regardless of document status. I'm seeing the EnvelopeDocument.DocumentFields as a potential, but not sure if this is proper for what I'm doing. Also seeing EnvelopeDefinition.CustomFields.*. Tried to use TextCustomFields but I don't see this displayed on the document (when show=true), let alone if this is attached to the envelope throughout it's lifecycle. Any help would be appreciated. Thanks!

Upvotes: 0

Views: 1063

Answers (1)

Kim Brandl
Kim Brandl

Reputation: 13500

When you create a DocuSign Envelope, you can specify custom metadata either at the Document-level or at the Envelope-level (by using "custom fields").

  • Document-level custom fields get associated with a specific document within an Envelope.
  • Envelope-level custom fields get associated with the Envelope itself.

Metadata that's specified using custom fields (regardless of whether at the Document-level or Envelope-level) will not be visible to Envelope recipients, but can be subsequently retrieved via API at any time.

Based on the information you've provided, it sounds like you're most likely interested in Envelope custom fields. I don't have much experience using the DocuSign C# SDK, but here's the JSON portion of a Create Envelope request that specifies a single custom field at the Envelope-level:

{
    "emailSubject": "Please Print, Complete and Sign Document",
    "emailBlurb": "Please print and complete documents and sign on paper. ",
    "status": "sent",
    "compositeTemplates": [{
        "inlineTemplates": [{
            "sequence": "1",        
            "customFields": {
                "textCustomFields": [{
                    "name": "MyOwnField",
                    "required": "true",
                    "show": "true",
                    "value": "MyValue"
                }]
            },
            "recipients": {
                "signers": [{
                    "requireSignOnPaper": "true",
                    "name": "John Doe",
                    "email": "[email protected]",
                    "recipientId": "1",
                    "routingOrder": "1"
                }]
            }
        }],
        "document": {
            "documentId": "1",
            "name": "AccountApplication.pdf",
            "transformPdfFields": false
        }
    }]
}

Based on this, if you're seeing EnvelopeDefinition.CustomFields.TextCustomFields in the C# SDK, I'd suspect that's what you'll use to create an Envelope Custom Field. As I mentioned earlier, recipients won't see the Envelope Custom Field value(s) in the DocuSign web UI, but you should be able to subsequently retrieve the Envelope Custom Field value(s) via API at any point in the Envelope lifecycle.

Update (C# code sample):

Based on a brief look at the C# SDK, here's a code sample that shows how to create two (text) custom fields on an Envelope:

// create a new envelope which we will use to send the signature request
EnvelopeDefinition envDef = new EnvelopeDefinition();

// create my first Envelope custom field
TextCustomField myFirstCustomField = new TextCustomField();
myFirstCustomField.Name = "field1";
myFirstCustomField.Value = "value1";

// create my second Envelope custom field
TextCustomField mySecondCustomField = new TextCustomField();
mySecondCustomField.Name = "field2";
mySecondCustomField.Value = "value2";

// add my custom fields to the envelope
envDef.CustomFields.TextCustomFields.Add(myFirstCustomField);
envDef.CustomFields.TextCustomFields.Add(mySecondCustomField);

...

Upvotes: 1

Related Questions