Michael Paccione
Michael Paccione

Reputation: 2817

DocuSign: how to attach custom properties to an envelope

Hello we are looking to attach an application number to Docusign request (an envelope) with the API.

How can we attach custom properties to an envelope, to pass some reference to a particular transaction, so it is part of the payload sent back in the webhook when signing is complete?. What we have tried is below:

 let recipients = docusign.Recipients.constructFromObject({
   signers: [signer1],
   carbonCopies: [cc1],
   applicationNo: app.id,
 })

 env.recipients = recipients
 env.applicationNo = "someApplicationNumber"
 env.status = args.status

Upvotes: 1

Views: 238

Answers (1)

Larry K
Larry K

Reputation: 49104

From your code example, it looks like you want to attach metadata at the envelope (transaction) level. To do that, use EnvelopeCustomFields

  • You can create use either strings or enumerated string values.
  • You can include them in the envelope definition. See here or you can use separate API calls for them
  • You can have them included in the certificate of completion document if you want.

Example using the Node.js SDK for an EnvelopeCustomField named applicationNo:

    let textCustomField1 = docusign.TextCustomField.constructFromObject({
        name: "applicationNo",  
        show: "true",    // show the field in the certificate of completion
        value: "12345" 
        });
    let textCustomFields1 = [textCustomField1];
    let customFields1 = docusign.CustomFields.constructFromObject({
        textCustomFields: textCustomFields1 
        });
...
    let envelopeDefinition = docusign.EnvelopeDefinition.constructFromObject({
        customFields: customFields1,  
        documents: documents1,  
        emailSubject: "Please sign the attached document",  
        recipients: recipients1,  
        status: "sent" 
        });

Same example in JSON:

  "envelopeDefinition": {
    "emailSubject": "Please sign the attached document",
    "status": "sent",
    "customFields": {
      "textCustomFields": [
        {
          "name": "applicationNo",
          "show": "true",
          "value": "12345"
        }
      ]
    },
    "documents": ....

The certificate of completion.

Notice the applicationNo data

enter image description here

Upvotes: 2

Related Questions