After reading (here and here) and trying out composite templates, I'm not quite sure I understand how to properly use the Server Templates within the API request. The documentation mentions If supplied they are overlaid into the envelope in the order of their Sequence value so I've interpreted this as they would be merged together as one document. It seems they are merged together but it is yielding a result that I would not expect. The first one in the sequence is what is shown and you cannot see the others.
What I'd like to do is have a couple common headers that contain our different logos and combine that with whatever template I'm sending out. We cannot use the branding approach because they want it as part of the document within the template and as far as I can tell, there is no way to make that happen with branding.
Below is my (scrubbed) request. See my comments.
{
"brandId": "{{brandId}}",
"emailSubject": "Testing Subject",
"status": "SENT",
"compositeTemplates": [{
"serverTemplates": [{ // First document
"sequence": "1",
"templateId": "{{headerTemplateId}}" //Header logo template
}, {
"sequence": "2",
"templateId": "{{document1TemplateId}}" // Template with content
}
],
"inlineTemplates": [{
"sequence": "1",
"recipients": {
"signers": [{
"email": "test#test.com",
"name": "Leeroy Jenkins",
"roleName": "Customer",
"recipientId": "1"
}
]
}
}
]
}, {
"serverTemplates": [{ // Second document
"sequence": "2",
"templateId": "{{document2TemplateId}}"
}
],
"inlineTemplates": [{
"sequence": "2",
"recipients": {
"signers": [{
"email": "test#test.com",
"name": "Leeroy Jenkins",
"roleName": "Customer",
"recipientId": "1",
"tabs": {
"textTabs": [{
"tabLabel": "Address",
"value": "123 Test Rd "
}, {
"tabLabel": "CityStateZip",
"value": "Test/XY/12345"
}
]
}
}
]
}
}
]
}
]
}
As #Drew says, your immediate issue is that each individual composite template can only include zero or one server template.
Re: How to properly use the Server Templates within a composite template
Each composite template composites together different aspects of an envelope:
Zero or one template definitions stored on docusign.com
Newly defined recipients, tabs, documents, etc.
For example, composite templates can be used to create an envelope that includes document "B" instead of using the document included in a template on docusign.com.
Changing logos in documents
Unfortunately, the DocuSign compositing feature does not include a feature for combining the images from one document with another document to create a new (combined) document.
Some ideas:
If only page one of the contract includes the logo, then you could have multiple versions of page one (treating each as a separate document), and combine the logoed page one with the other pages to form a complete envelope.
Note that a document can be as short as a page. Recipients will view all of the envelope's documents together.
Use a PDF library to manipulate the PDF document itself to change the logo. There are now many PDF libraries available, with APIs for many languages and operating systems.
Use a SAAS PDF rendering service to combine the images with the content to obtain the final PDF. Eg, webmerge
Send DocuSign the document in a non-PDF format. For example, you can send a .docx document. If you're using the Windows stack, it may be easier for your application to create a custom logo version of a Word doc than a PDF.
Related
Attempting to use the REST API Envelope Create to include Supplemental Documents in the envelope [no templates], so with the first object in the Documents array having a display value of ‘inline’ and the signerMustAcknowledge set to ‘null’ we have for the second object in the array used the display value of ‘modal’ and the signerMustAcknowledge set to ‘no_interaction’ or to ‘view’. When the recipient reviews the envelop online the supplemental document is not shown as grey strip below the primary document offering the reviewer any options, instead the document is expanded and shown in full. What other options do we need to set to get DocuSign to treat the second document as supplemental, as described in https://support.docusign.com/en/guides/ndse-user-guide-send-supplements.
Spoke to DocuSign Support yesterday to get the ‘Supplemental Documents’ functionality added to our Demo Account and the Permission Set on the User being used for this REST API connection has the ‘Disable document upload’ unchecked and the Allow supplemental documents option (and all related options below) is checked.
Example anonymised JSON:
{
"recipients": {
"signers": [
{
"routingOrder": 1,
"recipientId": "1",
"name": "Person-A",
"email": "person-a#website.com"
}
]
},
"emailSubject": "Test subject",
"emailBlurb": "Test blurb",
"documents": [
{
"signerMustAcknowledge": null,
"order": "asc",
"name": "MyCompany Quote",
"includeInDownload": null,
"documentId": "1",
"documentBase64": "JVBERi0xLjMKJcTl8uXrp/Og0M……",
"display": "inline"
},
{
"signerMustAcknowledge": "no_interaction",``
"order": "asc",
"name": "MyCompany Quote",
"includeInDownload": false,
"documentId": "2",
"documentBase64": "JVBERi0xLjQKJeLjz9MKMiAw……",
"display": "modal"
}
]
}
You are not assigning any DocuSign tabs to the signer? your documents part of JSON is correct, just not assigning tabs might be creating an issue. If you don't assign tabs then it is called free form signing which is not allowed in most of the plans and might not work for supplemental docs. Try by assigning atleast one tab to signer in the non-supplemental document. Lack of tabs is causing the issue.
I am currently using the REST api to create an envelope containing a document and a template which I have already set up in Docusign. I get the following error on the web request and can't find this error on the status code/error list provided by DocuSign to try debug the issue. Their support person suggests I ask here..
TAB_REFERS_TO_DOCUMENT_NO_TABS_ALLOWED -- The Tab refers to a document that does not allow tabs.
Has anyone experienced this?
Edit:
The issue appears to be related to the document section.
{
"emailBlurb":"Test Email Body",
"emailSubject": "Test Email Subject",
"status" : "sent",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence" : 1,
"templateId": "b1eccee3-9c00-4cb2-8d30-0400d51dcfe0"
}],
"inlineTemplates": [
{
"sequence" : 2,
"recipients": {
"signers" : [{
"email": "usera#bah.com",
"name": "usera",
"recipientId": "1",
"roleName": "Producer"
}]
}
}],
"document": {
"documentId": 1,
"name": "Test.docx",
"documentBase64":"[bytesremoved]",
"fileExtension":"docx"
}
}]
}
So you have a template on the server, with a document as part of the template?
But you want the envelope to use a different document with the template, yes?
It is my understanding that the documentId in the document section of the composite template must match the documentId used in the template if you want the document to be substituted for the template's document.
So check the definition of the template. Did you create the template programmatically or did you use the web browser DocuSign app? If the latter, then note that the first document in a template is not always given an id of 1.
Using the docusign rest api i would like to create an envelope with 2 documents.
I will then be using the Post Recipient view to show document 1 to the first recipient (in an iframe) and once signed show document 2 in the same envelope to another recipients.
i have created the templates with different tempalteRoles (different names, order 5 and 10).
Its my understanding using a userId and the right settings in my docusign account, i can show document 1 to recipient 1 and then document 2 to recipient 2.
When i try and create the composite envelope the whole document is shown.
when i call the recipient status for the envelope it only shows one signer.
I have found the envelope will only create when the 2 template roles have the same clientUserId, userName and email, otherwise i get the error "ONESIGNALLSIGN_NOT_SATISFIED"
here is the envelope i am sending through
{
"accountId": "ACCOUNT_ID",
"emailSubject": "Email subject",
"status": "sent",
"templateId": "TEMPLATE_ID",
"templateRoles": [
{
"roleName": "PDS Customer",
"email": "pds#example.com",
"name": "TestFirstName TestSurname",
"clientUserId": "1",
"tabs": {
"textTabs": [
{
"tabLabel": "DocumentNumber",
"value": "123456789",
"locked": true,
"documentId": 1,
"pageNumber": 1
}
...removed some
]
}
},
{
"roleName": "Customer",
"email": "test#example.com",
"name": "mrTestFirstName TestSurname",
"clientUserId": "2",
"tabs": {
"textTabs": [
{
"tabLabel": "StorerEmail_LocalPart",
"value": "test",
"locked": true,
"documentId": 2,
"pageNumber": 1
}
...removed some
]
}
}
],
"compositeTemplates": [
{
"compositeTemplateId": 1,
"serverTemplates": [
{
"sequence": 1,
"templateId": "TEMPLATE_ID_2"
}
]
}
]
}
The error message is due to having Document Visibility enabled. In that scenario, each signer must have at least one tab present. Your second signer (embedded or not) must have at least one tab. In this case it'd probably be on the second document.
Your API call above does refer to a second documentId though so you may be okay there.
I would suggest that you not mix the "simple" sending (using templateRoles at the top level) with composite templates. Instead, add an inline template to the compositeTemplates structure with all of your recipient information. You may be seeing some odd behavior due to mixing those.
Lastly, the default Document Visibility configuration will show a document to a recipient only if they have a tab on that document. If your second signer should see all documents then you must either add a tab for them on each document or explicitly set visibility per document.
I am trying to send an envelope that is composed of
Template1 (1 pdf document)
Template2 (2 pdf documents, 1-regular fill-out, 2-with attach extra document tab)
If I use just template1 or template2 individually, I am able to send out the envelope. However, I can not send it both templates at the same time, I get the following error, and not sure what it means.
<errorDetails xmlns="http://www.docusign.com/restapi" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<errorCode>TAB_REFERS_TO_MISSING_DOCUMENT</errorCode>
<message>The DocumentId specified in the tab element does not refer to a document in this envelope. Tab refers to DocumentId 2 which is not present.</message>
</errorDetails>
Here is the code that I am using:
{
"emailSubject": "Account Setup",
"emailBlurb": "Please fill out the form",
"status": "sent",
"compositeTemplates": [{
"compositeTemplateId": "compositeTemplate1",
"serverTemplates": [
/* STANDARD ACCOUNT FORM */
{
"sequence": "2",
"templateId": "182B70AD-*"
},
/* ELECTRONIC TRANSFER FORM */
{
"sequence": "3",
"templateId": "B2B0BF8D-*"
}
],
"inlineTemplates": [{
"sequence": "1",
"recipients": {
"signers": [{
"email": "email#gmail.com",
"name": "First Last",
"recipientId": "1",
"roleName": "Client",
"RequireIDLookup": "true",
"RequireIDLookupSpecified": "true",
"idCheckConfigurationName": "Phone Auth $",
"phoneAuthentication": {
"recipMayProvideNumber": "false",
"senderProvidedNumbers": [
"914-000-0000"
]
}
}]
}
}]
}]
}
Please advise.
Perhaps try changing the value of sequence in each of your server template objects and in the inline template object as well, to indicate that the server template should be applied first (and second), and then the inline template should be applied after that:
"serverTemplates": [
/* STANDARD ACCOUNT FORM */
{
"sequence": "1",
"templateId": "182B70AD-*"
},
/* ELECTRONIC TRANSFER FORM */
{
"sequence": "2",
"templateId": "B2B0BF8D-*"
}
],
"inlineTemplates": [{
"sequence": "3",
"recipients": {
....
------UPDATE------
The Template XML you provided suggests that the problematic tag (the one causing the error message you're receiving) is the SignerAttachment tag with TabLabel set to "Signer Attachment 34" in the Electronic Funds Transfer Form template. This tag is the only tag (in either XML file) that refers to DocumentID value 2 (I simply searched both XML files for <DocumentID>2</DocumentID>):
<Tab>
<DocumentID>2</DocumentID>
<RecipientID>1</RecipientID>
<PageNumber>1</PageNumber>
<XPosition>12</XPosition>
<YPosition>104</YPosition>
<ScaleValue>1</ScaleValue>
<Type>SignerAttachment</Type>
<Name>Signer Attachment</Name>
<TabLabel>Signer Attachment 34</TabLabel>
<Value />
<CustomTabRequired>false</CustomTabRequired>
<CustomTabLocked>false</CustomTabLocked>
<TemplateLocked>true</TemplateLocked>
<TemplateRequired>false</TemplateRequired>
</Tab>
This is problematic for DocuSign, because the value of DocumentID indicates the document in which the tag resides (i.e., where the signer will see that tag during their signing session). So, DocuSign's looking to place this tag in the document that has an ID=2 -- but, if you examine the contents of <Documents> within that XML file, you'll see only a single document (with ID=1) -- there is no second document (i.e., no document with ID=2):
<Documents>
<Document>
<ID>1</ID>
<Name>File1.pdf</Name>
<PDFBytes/>
<AttachmentDescription>Please attach voided check, deposit slip or a copy of bank statement.</AttachmentDescription>
</Document>
</Documents>
I'm not sure how things might have gotten to this state (i.e., why the DocumentID for the Signer Attachment tag refers to a document ID that doesn't exist). However, doing the following might resolve the issue:
Edit the Electronic Funds Transfer Form Template in DocuSign -- remove/delete the Signer Attachment tag; save the Template.
Attempt your original scenario (send the Envelope using both templates). If it works, then this will confirm that the Signer Attachment tag was indeed the cause of your problem.
Edit the Electronic Funds Transfer Form Template in DocuSign -- add a new Signer Attachment tag in the same location as the original (removed) one existed; save the Template.
Attempt your original scenario (send the Envelope using both templates).
I suspect this will resolve your issue, but let me know if that's not the case.
I've been able to successfully start an envelope with a template using the templateID, but I'm attempting to generate an envelope with two documents inside that both have templates. In the DocuSign website interface it's possible to start a new envelope then "check off" multiple templates to add to the envelope.
I've found the API calls to:
Start an envelope with a template
Get a template
Add a document to an envelope
However, there's unfortunately nothing that I can find to add a template to a draft envelope once it's been created. The question here, in case it's not obvious, is: what is the API call to generate a new document from a template and add it to a pre-existing envelope in created status?
You can create an envelope based on multiple templates. The trick is to use the compositeTemplates optional property of the request.
Back in April 2013 I hosted a webinar focused on templates where I demonstrated 3 different template examples. They were increasing in complexity leading up to the third, where that last one shows how to combine multiple templates into one envelope. Here is the Gist for it, which contains PHP code and sample JSON bodies:
https://github.com/Ergin008/DocuSign-REST-API-Webinar-April2013
Here is the JSON for the third example, you'll want to add something similar to your request body:
{
"emailSubject": "DocuSign Templates Webinar - Example 3",
"emailBlurb": "Example #3 - Composite Templates",
"status": "sent",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence": "1",
"templateId": "55A80182-2E9F-435D-9B16-FD1E1C0F9D74"
}
],
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"email": "test#docusign.com",
"name": "First Recipient",
"recipientId": "1",
"roleName": "RoleOne"
}
]
}
}
]
},
{
"serverTemplates": [
{
"sequence": "2",
"templateId": "44D9E888-3D86-4186-8EE9-7071BC87A0DA"
}
],
"inlineTemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"email": "test2#docusign.com",
"name": "Recipient 2",
"recipientId": "1",
"roleName": "RoleOne"
}
]
}
}
]
}
]
}
Note that the sequence property of the server template can be used to change the order that the template documents show up in the envelope.
To add to Ergin's answer.
You can add a template to an existing envelope using the applyEnvelopeTemplates api.
You can add templates to a document in the specified envelope using the EnvelopeTemplate:applyToDocuments api