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.
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.\\*"
}
]
}
}
]
}
}
]
}
]
}