0

I have requirement to to show multiple tables with dynamic data in each table.

And table is not required to be shown if rows are not present.

Currently I'm generating HTML structure for dynamic tables but don't see any way to embed HTML in existing template.

On template side there is 2nd page and there is space, and thats where I want to embed the tables

I'm new to DocuSign so please route me towards the appropriate resource if there is any to achieve this.

Sudhir Dhumal
  • 902
  • 11
  • 22

1 Answers1

1

There are a few different things here.

First, using HTML for generating envelopes for signing. You can use what we call "responsive signing" where the HTML itself is used for the signing ceremony, not being first converted to a PDF. To learn how to do this follow - https://developers.docusign.com/docs/esign-rest-api/how-to/creating-signable-html/

Now, I believe your bigger issue is how to use a template and then still add/modify one of the documents. There are few ways to do this, but the recommended method is to use Composite Templates, which provide the most flexibility and allow you to do exactly what you want.

Here is an example of what the JSON would look like (add your templateId and the document you want)

{
  "emailSubject": "Please fill in and sign all required fields.",
  "emailBlurb": "Composite template examle",
  "status": "sent",
  "compositeTemplates": [
    {
      "document": {
        "documentId": "1",
        "name": "Client Agreement.pdf",
        "documentFields": [
          {
            "name": "Brand",
            "value": "02-DBA_Vendarealm"
          }
        ],
        "htmlDefinition": {
          "source": "document"
        },
        "documentBase64": "JVBERi0xL..."
      },
      "serverTemplates": [
        {
          "sequence": "1",
          "templateId": "55A80182-xxxx-xxxx-xxxx-FD1E1C0F9D74"
        }
      ],
      "inlineTemplates": [
        {
          "sequence": "2",
          "recipients": {
            "signers": [
              {
                "email": "johndoe@example.com",
                "name": "John Doe",
                "recipientId": "1",
                "roleName": "Client"
              }
            ]
          }
        }
      ]
    },
    {
      "serverTemplates": [
        {
          "sequence": "1",
          "templateId": "44D9E888-xxxx-xxxx-xxxx-7071BC87A0DA"
        }
      ],
      "inlineTemplates": [
        {
          "sequence": "2",
          "recipients": {
            "signers": [
              {
                "email": "johndoe@example.com",
                "name": "John Doe",
                "recipientId": "1",
                "roleName": "Client"
              },
              {
                "email": "bensellen@talley.com",
                "name": "Ben Sellen",
                "recipientId": "2",
                "roleName": "Approver"
              }
            ]
          }
        }
      ]
    },
    {
      "document": {
        "documentId": "3",
        "name": "OrderForm_201.pdf",
        "htmlDefinition": {
          "source": "document"
        },
        "transformPdfFields": "true",
        "documentBase64": "JVBERi0xL..."
      },
      "inlineTemplates": [
        {
          "sequence": "2",
          "recipients": {
            "signers": [
              {
                "email": "johndoe@example.com",
                "name": "John Doe",
                "recipientId": "1",
                "roleName": "Client",
                "tabs": {
                  "signHereTabs": [
                    {
                      "tabLabel": "Client.\\*"
                    }
                  ],
                  "dateSignedTabs": [
                    {
                      "tabLabel": "Client.\\*"
                    }
                  ],
                  "fullNameTabs": [
                    {
                      "tabLabel": "Client.\\*"
                    }
                  ],
                  "textTabs": [
                    {
                      "tabLabel": "Client.Email.\\*",
                      "customTabValidationPattern": "^\\w+@[a-zA-Z_]+?\\.[a-zA-Z]{2,3}$",
                      "customTabRequired": "true"
                    },
                    {
                      "tabLabel": "Client.\\*"
                    }
                  ]
                }
              }
            ]
          }
        }
      ]
    }
  ]
}
Inbar Gazit
  • 12,566
  • 1
  • 16
  • 23
  • Hi @inbar-gazit I was able embed the document using composite-template but now I see one minor problem: I see that the HTML document is displayed in popup and on clicking next I get pages from template + html document. any possible field which I'm missing here? – Sudhir Dhumal Dec 12 '22 at 11:34
  • I don't think I understand the issue. Are the documents in the envelope not the ones you expected to find? – Inbar Gazit Dec 12 '22 at 17:15
  • I expected the view with documents from template plus HTML document and this part is working as expected but before I get to final consolidated screen I get intermediate screen which displays HTML document with Next button – Sudhir Dhumal Dec 12 '22 at 18:33
  • When I click on Next button I get the expected screen (PDF from template plus HTML generated document) – Sudhir Dhumal Dec 12 '22 at 18:34
  • Intermediate screen which displays only HTML part is seems to be opening in popup with Next button – Sudhir Dhumal Dec 12 '22 at 18:35
  • This is DocuSign functionality, not sure there's anything you can do about this. Unless, I don't understand your issue. Maybe include a video/screenshots – Inbar Gazit Dec 12 '22 at 19:03