docusignapipower-automate-custom-connector

How do I populate Document Custom Field values in DocuSign from Power Automate using API


I'm passing documents from a sharepoint list to Docusign using Power Automate for signing via the API following this document: https://www.docusign.com.au/blog/get-the-flow-sending-docusign-envelopes-microsoft-power-automate. The documents are not standard templates, the documents could contain any content with the exception of a standard "signing block" for names, titles and company detail, as well as signature and dates for signatories. Each of these have an Autoplace placeholder (tags) in the document being passed to Docusign. I have configured Document Custom Fields as "Text Fields" for the fields "name", "title", and "company" in DocuSign with defined AutoPlace tags that align with the AutoPlace tags in the documents being passed. When the document is viewed for signing in DocuSign, those fields are present in the DocuSign document however they are not populated.

How do I pass data values for those fields using the API?

Here is the recipient portion of the Swagger Code within the Power Automate Custom Connector.

        schema:
          type: object
          properties:
            documents:
              type: array
              items:
                type: object
                properties:
                  documentBase64: {type: string, description: documentBase64}
                  documentId: {type: string, description: documentId}
                  fileExtension: {type: string, description: fileExtension}
                  name: {type: string, description: name}
                  order: {type: string, description: order}
              description: documents
            emailSubject: {type: string, description: emailSubject}
            emailBlurb: {type: string, description: emailBlurb}
            recipients:
              type: object
              properties:
                signers:
                  type: array
                  items:
                    type: object
                    properties:
                      email: {type: string, description: email}
                      name: {type: string, description: name}
                      title: {type: string, description: title}
                      company: {type: string, description: company}
                      recipientId: {type: string, description: recipientId}
                      roleName: {type: string, description: roleName}
                      routingOrder: {type: string, description: routingOrder}
                  description: signers
              description: recipients
            status: {type: string, description: status}

Solution

  • The answer is to use textTabs, not custom fields. textTabs are properties of "tabs" which are properties of "recipients", not "documents". Following this documentation: https://developers.docusign.com/docs/esign-rest-api/how-to/set-envelope-tab-values/ I was able to create a swagger 'recipients' schema for the DocuSign Custom Connector, which provides fairly significant control over the tab including font style, anchor offset, etc. Then in your Power Automate (Flow) you can build out your JSON with as many textTabs (fields) as you need. Just make sure your placeholders in your document match the "anchorString" property in the json(that had me chasing a bug for a while!).

    New schema:

                recipients:
                  type: object
                  properties:
                    signers:
                      type: array
                      items:
                        type: object
                        properties:
                          email: {type: string, description: email}
                          name: {type: string, description: name}
                          recipientId: {type: string, description: recipientId}
                          roleName: {type: string, description: roleName}
                          routingOrder: {type: string, description: routingOrder}
                          tabs:
                            type: object
                            properties:
                              textTabs:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    anchorString: {type: string, description: anchorString}
                                    anchorUnits: {type: string, description: anchorUnits}
                                    anchorXOffset: {type: string, description: anchorXOffset}
                                    anchorYOffset: {type: string, description: anchorYOffset}
                                    bold: {type: string, description: bold}
                                    font: {type: string, description: font}
                                    fontSize: {type: string, description: fontSize}
                                    locked: {type: string, description: locked}
                                    tabId: {type: string, description: tabId}
                                    tabLabel: {type: string, description: tabLabel}
                                    value: {type: string, description: value}
                                description: textTabs
                            description: tabs
                      description: signers
                  description: recipients
    

    To import into the DocuSign Custom Connector at the 'Import from Sample' on the 'Definition' tab when creating the connector using the DocuSign Guide: https://www.docusign.com.au/blog/get-the-flow-sending-docusign-envelopes-microsoft-power-automate, you can import the following into 'body:

    {
        "documents": [
          {
            "documentBase64": "[variable]",
            "documentId": "1",
            "fileExtension": "txt",
            "name": "Doc1",
            "order": "1"
          }
        ],
        "emailSubject": "Test Envelope 1",
        "emailBlurb": "This is the email body",
        "recipients": {
          "signers": [
            {
              "email": "[enter signer email address]",
              "name": "[enter signer name]",
              "title": "[enter signer title]",
              "company": "[enter signer company name]",
              "recipientId": "1",
              "roleName": "Signer 1",
              "routingOrder": "1",
                "tabs": {
                  "textTabs": [
                    {
                    "anchorString": "/sn1/",
                    "anchorUnits": "pixels",
                    "anchorXOffset": "5",
                    "anchorYOffset": "-9",
                    "bold": "true",
                    "font": "helvetica",
                    "fontSize": "size11",
                    "locked": "false",
                    "tabId": "signer1_name",
                    "tabLabel": "Signer1 Name",
                    "value": ""
                  }
                ]
              }
            }
          ]
        },
        "status": "sent"
      }