DocuSign: recipient signerAttachmentTabs inappropriately replicated - docusignapi

I'm trying to create an envelope using DocuSign REST API. The signature tabs are generated by converting the PDF signature fields, and a signerAttachment tab is added manually.
In the final envelope, there is (as expected) only one signHere tab, but three overlapping signerAttachment tabs, which must be acted upon (read: upload a file) before the envelope can be effectively signed.
Case details
The envelope has 2 documents, one of which has signature tabs generated by transforming PDF fields. There are two recipients, one signer and one "Carbon Copy". The signer, before completing the envelope, must upload an additional document, so I added a signerAttachmentTab.
The JSON sent to the API endpoint /restapi/v2.1/accounts/{accountId}/envelopes follows (null values omitted and sensitive information redacted):
{
"compositeTemplates": [
{
"compositeTemplateId": "0",
"document": {
"documentBase64": "(redacted)",
"documentId": "1",
"fileExtension": "pdf",
"name": "Summary",
"transformPdfFields": "true"
},
"inlineTemplates": [
{
"envelope": {
"emailBlurb": "Just a test for development. Ignore this message",
"emailSubject": "from unit-test 01"
},
"recipients": {
"carbonCopies": [
{
"email": "john.doe#company.com",
"name": "John Doe",
"recipientId": "00283187",
"roleName": "CCOPY",
"routingOrder": "1"
}
],
"signers": [
{
"email": "jane.dee#company.com",
"name": "Jane Dee",
"recipientId": "00283183",
"recipientSignatureProviders": [
{
"signatureProviderName": "(redacted)",
"signatureProviderOptions": {
"sms": "+000-000-000"
}
}
],
"roleName": "SIGNER",
"routingOrder": "1",
"tabs": {
"signerAttachmentTabs": [
{
"xposition": "10",
"yposition": "10",
"documentId": "3",
"name": "Attachment",
"pageNumber": "1",
"recipientId": "00283183",
"tabLabel": "Attach-document",
"tooltip": "SignerAttachment",
"xPosition": "10",
"yPosition": "10"
}
],
"signHereTabs": [
{
"anchorAllowWhiteSpaceInCharacters": "true",
"recipientId": "00283183",
"tabLabel": "firmatario_00283183\\*"
}
]
},
"userId": "00283183"
}
]
},
"sequence": "1"
}
]
},
{
"compositeTemplateId": "1",
"document": {
"documentBase64": "(redacted)",
"documentId": "2",
"fileExtension": "pdf",
"name": "sample0",
"transformPdfFields": "true"
},
"inlineTemplates": [
{
"customFields": {
},
"envelope": {
"emailBlurb": "Just a test for development. Ignore this message",
"emailSubject": "from unit-test 01"
},
"recipients": {
"carbonCopies": [
{
"email": "john.doe#company.com",
"name": "John Doe",
"recipientId": "00283187",
"roleName": "CCOPY",
"routingOrder": "1"
}
],
"signers": [
{
"email": "jane.dee#company.com",
"name": "Jane Dee",
"recipientId": "00283183",
"recipientSignatureProviders": [
{
"signatureProviderName": "(redacted)",
"signatureProviderOptions": {
"sms": "+000-000-000"
}
}
],
"roleName": "SIGNER",
"routingOrder": "1",
"tabs": {
"signerAttachmentTabs": [
{
"xposition": "10",
"yposition": "10",
"documentId": "3",
"name": "Attachment",
"pageNumber": "1",
"recipientId": "00283183",
"tabLabel": "Attach-document",
"tooltip": "SignerAttachment",
"xPosition": "10",
"yPosition": "10"
}
],
"signHereTabs": [
{
"anchorAllowWhiteSpaceInCharacters": "true",
"recipientId": "00283183",
"tabLabel": "firmatario_00283183\\*"
}
]
},
"userId": "00283183"
}
]
},
"sequence": "2"
}
]
},
{
"compositeTemplateId": "2",
"document": {
"documentBase64": "(redacted)",
"documentId": "3",
"fileExtension": "pdf",
"name": "sample1",
"transformPdfFields": "true"
},
"inlineTemplates": [
{
"envelope": {
"emailBlurb": "Just a test for development. Ignore this message",
"emailSubject": "from unit-test 01"
},
"recipients": {
"carbonCopies": [
{
"email": "john.doe#company.com",
"name": "John Doe",
"recipientId": "00283187",
"roleName": "CCOPY",
"routingOrder": "1"
}
],
"signers": [
{
"email": "jane.dee#company.com",
"name": "Jane Dee",
"recipientId": "00283183",
"recipientSignatureProviders": [
{
"signatureProviderName": "(redacted)",
"signatureProviderOptions": {
"sms": "+000-000-000"
}
}
],
"roleName": "SIGNER",
"routingOrder": "1",
"tabs": {
"signerAttachmentTabs": [
{
"xposition": "10",
"yposition": "10",
"documentId": "3",
"name": "Attachment",
"pageNumber": "1",
"recipientId": "00283183",
"tabLabel": "Attach-document",
"tooltip": "SignerAttachment",
"xPosition": "10",
"yPosition": "10"
}
],
"signHereTabs": [
{
"anchorAllowWhiteSpaceInCharacters": "true",
"recipientId": "00283183",
"tabLabel": "firmatario_00283183\\*"
}
]
},
"userId": "00283183"
}
]
},
"sequence": "3"
}
]
}
],
"notification": {
"expirations": {
"expireAfter": "2",
"expireEnabled": "true"
}
},
"status": "sent",
"transactionId": "55909b0d-b54f-454e-b966-e58ca5fb4e7e"
}
The envelope definition has been written following the guidelines by DocuSign, namely by inserting a composite template for each document and assigning the recipients to each one of them.
Now, I expect that, despite the same recipients being declared three times (one for each document), they will be merged in the final envelopes, as per this quote from the same page:
When you use multiple templates to create an envelope, two or more templates may define the same recipient (a recipient with the same role or even the same name as other recipients), creating duplicate recipients. You can automatically merge these duplicate recipients by making sure that each of these duplicate recipients has the same email, user name, and routing order. In this case, any duplicate recipients are merged together after all template overlays have been applied.
What I observe is that, in the final envelope, there is -- as expected -- only one signature field, but three overlapping signerAttachment field. Therefore, the signer has to upload the same file three times to complete the envelope.
A call to the endpoint /restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/tabs confirms the presence of three similar tabs:
{
"signHereTabs": [
{
"stampType": "signature",
"isSealSignTab": "false",
"name": "SignHere",
"tabLabel": "firmatario_00283183_Firma consulenza_001",
"scaleValue": "1",
"optional": "false",
"documentId": "3",
"recipientId": "1",
"pageNumber": "1",
"xPosition": "391",
"yPosition": "719",
"width": "0",
"height": "0",
"tabId": "2cee0f3e-a2bb-4aae-a5b4-82c66b177c0a",
"tabType": "signhere"
}
],
"signerAttachmentTabs": [
{
"name": "Attachment",
"tabLabel": "Attach-document",
"scaleValue": "1",
"optional": "false",
"documentId": "3",
"recipientId": "1",
"pageNumber": "1",
"xPosition": "10",
"yPosition": "10",
"width": "0",
"height": "0",
"tabId": "a67c3071-6ac4-4c3b-a20c-0197cda091ed",
"tabType": "signerattachment",
"tooltip": "SignerAttachment"
},
{
"name": "Attachment",
"tabLabel": "Attach-document",
"scaleValue": "1",
"optional": "false",
"documentId": "3",
"recipientId": "1",
"pageNumber": "1",
"xPosition": "10",
"yPosition": "10",
"width": "0",
"height": "0",
"tabId": "c20809de-3792-4ff7-ab31-6f09a13f3fbc",
"tabType": "signerattachment",
"tooltip": "SignerAttachment"
},
{
"name": "Attachment",
"tabLabel": "Attach-document",
"scaleValue": "1",
"optional": "false",
"documentId": "3",
"recipientId": "1",
"pageNumber": "1",
"xPosition": "10",
"yPosition": "10",
"width": "0",
"height": "0",
"tabId": "1d0c84cd-6511-47c2-a75f-73721ac2fb0f",
"tabType": "signerattachment",
"tooltip": "SignerAttachment"
}
]
}
Why the signerAttachment tabs are not merged like the signHere tabs and what can be done to merge them in the resulting envelope?

I believe the issue is that in the case of the SignHere tab, your InLineTemplate is not creating the SignHere tabs, it is providing/updating the settings for the existing tab where the tabLabel is "firmatario_00283183"
(The tab is existing because it was created as part of the PDF transformation.)
In contrast, your three definitions for the SignerAttachment tabs are each creating new tabs. So you're seeing the three new SignerAttachment tabs on the document.
Solution: only create as many SignerAttachment tabs as you want. There is no merging (supression) of tabs, just merging of the Recipients.
I will admit that I'm not a gonzo expert on CompositeTemplates. But I think I'm on reasonably firm ground here.

Each signerAttachmentTab specified in each compositeTemplate has specified the same document for placement - "documentId": "3", so each of your composites is placing a new signer attachment tab to the same document, ID 3. If you only want one signer attachment, only specify it in the requisite composite. For documentId = 3, that would be your third composite. If you want an attachment tab on each document, then make sure you specify the correct documentId.

Related

Docusign API Explorer not pre-populating fields

I tried filling in the tabs with labels and values, but when I send the request the tabs are not pre-populated, also does anyone know how does the fullname tab get populated?
{
"emailSubject": "Welcome to Soul Gym",
"status": "sent",
"templateId": "196b0d27-b967-4380-bb2c-013051ec9e45",
"templateRoles": [
{
"clientUserId": "marcus.yeo#business.edu.sg",
"email": "marcus.yeo#business.edu.sg",
"name": "Marcus Yeo",
"roleName": "New Member",
"tabs": {
"emailTabs": [
{
"tabLabel": "Email",
"value": "marcus.yeo#business.edu.sg"
}
],
"fullNameTabs": [
{
"tabLabel": "FullName"
},
{
"tabLabel": "FullName2"
}
],
"textTabs": [
{
"tabLabel": "Address",
"value": "32 Duke Road"
}
]
}
}
]
It looks like you're missing the documentId and tabPositions to display the full name on your document. Here is an example working request body with raw document omitted:
{
"documents": [
{
"documentBase64": "<Base64BytesHere>",
"documentId": "1",
"fileExtension": "docx",
"name": "testFile"
}
],
"emailSubject": "testing envelope",
"recipients": {
"signers": [
{
"email": "john.doe#example.com",
"name": "Docusign Test Signer",
"recipientId": "1",
"routingOrder": "1",
"tabs": {
"fullNameTabs": [
{
"documentId": "1",
"pageNumber": "1",
"xPosition": "280",
"yPosition": "172"
},
{
"documentId": "1",
"pageNumber": "1",
"xPosition": "480",
"yPosition": "300"
}
],
"signHereTabs": [
{
"documentId": "1",
"pageNumber": "1",
"xPosition": "120",
"yPosition": "300"
}
]
}
}
]
},
"status": "sent"
}
And the resulting fullName placement shown on a demo document I tried with this request json:
Though I didn't use an envelope templateId here, the mechanism works the same, set the documentID, pageNumber, & x/y coordinates to inject the fullName on your documents. Feel free to check out the Quickstart tool as well to find a full DocuSign implementation in a language of your choice that you can modify to suit your needs.

JSON Docusign Inline mulitpule Documents

I have my Json working for single document and transforms the PDF fields, but when I try to add second document. I Get JSON Parse error.
This works
"document": {
"documentId": "1",
"name": "Test Contract With Fields.pdf",
"transformPdfFields": "true",
"documentBase64": "'.$documentHashpdf.'"
}
this also works but doesn't transforms the PDFFields.
"inlineTemplates": [
{
"documents": [
{
"documentBase64": "<Base64BytesHere>",
"documentId": "1",
"name": "test",
"transformPdfFields": "true"
},
{
"documentBase64": "<Base64BytesHere>",
"documentId": "2",
"name": "test 2",
"order": "2"
}
],
Adding Square [] and second document breaks. Tried making Documents
"document": [{
"documentId": "1",
"name": "Test Contract With Fields.pdf",
"transformPdfFields": "true",
"documentBase64": "'.$documentHashpdf.'"
},
{
"documentId": "2",
"name": "Test Contract With Fields 2.pdf",
"transformPdfFields": "true",
"documentBase64": "'.$documentHashpdf.'"
}]
**Update: Complete JSON
Looking to add a second **document****
{
"emailBlurb": "Test Blurb",
"emailSubject": "Test subject",
"status": "sent",
"compositeTemplates": [
{
"compositeTemplateId": "1",
"inlineTemplates": [
{
"sequence": "1","documents": [
{
"documentBase64": "'.$documentHashpdf.'",
"documentId": "2",
"name": "Not working", "order": "2"
}
],
"recipients": {
"signers": [
{
"email": "*******",
"name": "********e",
"recipientId": "1",
"smsAuthentication": {
"senderProvidedNumbers": ["******"]
},
"idCheckConfigurationName": "SMS Auth $",
"requireIdLookup": "true",
"clientUserId": "1001",
"defaultRecipient": "true",
"tabs": {
"signHereTabs": [
{
"pageNumber": "1",
"documentId": "1",
"tabLabel": "text 1",
"recipientId": "1"
}
],
"fullNameTabs": [
{
"pageNumber": "1",
"documentId": "1",
"xPosition": "20",
"yPosition": "20",
"height": "10",
"width": "20",
"tabLabel": "Text 2",
"recipientId": "1"
}
],
"dateSignedTabs": [
{
"pageNumber": "1",
"documentId": "1",
"xPosition": "20",
"yPosition": "30",
"height": "10",
"width": "20",
"tabLabel": "text 3",
"recipientId": "1"
}
]
}
}
]
}
}
],
"document": {
"documentId": "1",
"name": "Working",
"transformPdfFields": "true",
"documentBase64": "'.$documentHashpdf.'"
} }
]
There are 3 "models" for constructing envelopes. I recommend using composite templates in the intended way, where you manage each document contribution to the envelope by enclosing within separate compositeTemplate elements. I reworked your JSON like this:
{
"emailBlurb": "Test Blurb",
"emailSubject": "Test subject",
"status": "sent",
"compositeTemplates": [{
"compositeTemplateId": "1",
"document": {
"documentId": "1",
"name": "Working",
"transformPdfFields": "true",
"documentBase64": "'.$documentHashpdf.'"
},
"inlineTemplates": [{
"sequence": "1",
"recipients": {
"signers": [{
"email": "*******",
"name": "********e",
"recipientId": "1",
"smsAuthentication": {
"senderProvidedNumbers": ["******"]
},
"idCheckConfigurationName": "SMS Auth $",
"requireIdLookup": "true",
"clientUserId": "1001",
"defaultRecipient": "true"
}]
}
}]
},
{
"compositeTemplateId": "2",
"document": {
"documentBase64": "'.$documentHashpdf.'",
"documentId": "2",
"name": "Not working",
"transformPdfFields": "true"
},
"inlineTemplates": [{
"sequence": "1",
"recipients": {
"signers": [{
"email": "*******",
"name": "********e",
"recipientId": "1",
"smsAuthentication": {
"senderProvidedNumbers": ["******"]
},
"idCheckConfigurationName": "SMS Auth $",
"requireIdLookup": "true",
"clientUserId": "1001",
"defaultRecipient": "true"
}]
}
}]
}
]
}
In this fashion, any number of additional documents you wish to add would simply be another compositeTemplate element added to the array. This works for additional documents regardless of whether you wish to transform PDF fields, documents sourced from DocuSign templates, or any additional document for which you want to apply a template to overlay.
Note that the use of compositeTemplateId is only needed to relate multipart form attachments, which is a cleaner way to handle your documents rather than base64 encoding them in documentBase64 elements.
Here is the fixed JSON:
{
"emailBlurb": "Test Blurb",
"emailSubject": "Test subject",
"status": "sent",
"compositeTemplates": [
{
"compositeTemplateId": "1",
"inlineTemplates": [
{
"sequence": "1","documents": [
{
"documentBase64": "'.$documentHashpdf.'",
"documentId": "2",
"name": "Not working", "order": "2"
}
],
"recipients": {
"signers": [
{
"email": "*******",
"name": "********e",
"recipientId": "1",
"smsAuthentication": {
"senderProvidedNumbers": ["******"]
},
"idCheckConfigurationName": "SMS Auth $",
"requireIdLookup": "true",
"clientUserId": "1001",
"defaultRecipient": "true",
"tabs": {
"signHereTabs": [
{
"pageNumber": "1",
"documentId": "1",
"tabLabel": "text 1",
"recipientId": "1"
}
],
"fullNameTabs": [
{
"pageNumber": "1",
"documentId": "1",
"xPosition": "20",
"yPosition": "20",
"height": "10",
"width": "20",
"tabLabel": "Text 2",
"recipientId": "1"
}
],
"dateSignedTabs": [
{
"pageNumber": "1",
"documentId": "1",
"xPosition": "20",
"yPosition": "30",
"height": "10",
"width": "20",
"tabLabel": "text 3",
"recipientId": "1"
}
]
}
}
]
}
},
{
"documentId": "1",
"name": "Working",
"transformPdfFields": "true",
"documentBase64": "'.$documentHashpdf.'"
}
]}
]
}

DocuSign Rest API- Is there a way to configure three optional fields such that if one of them is filled the other two must also field

Hi I am using Docusign rest api. I have a scenario where I have three fields that needs to be filled by the same person(2 text and 1 signature all of them optional). Is there a way to make them such that if one of the text field is filled the signature must be required?
I am trying to use "conditionalParentLabel" and "conditionalParentValue" to achieve this fuctionality but I am not sure what value to give for "conditionalParentvalue" so that the required will get activated for all text input except blank.
Here is a sample CreateEnvelope call that could work for you.
POST /v2/accounts/{accountId}/envelopes
{
"recipients": {
"signers": [
{
"email": "janedoe#yourdomain.com",
"name": "Jane Doe",
"recipientId": 1,
"tabs": {
"signHereTabs": [
{
"optional": "false",
"documentId": "1",
"pageNumber": "1",
"xPosition": "279",
"yPosition": "89",
"conditionalParentLabel": "Amount",
"conditionalParentValue": "##ANY##"
}
],
"textTabs": [
{
"height": 11,
"width": 78,
"required": "false",
"locked": "false",
"maxLength": 100,
"tabLabel": "Amount",
"documentId": "1",
"pageNumber": "1",
"xPosition": "117",
"yPosition": "119"
}
]
}
}
]
},
"emailSubject": "Requesting signature with conditional fields",
"documents": [
{
"documentId": "1",
"name": "Doc One",
"fileExtension": "txt",
"documentBase64": "RG9jIFRXTyBUV08gVFdP"
}
],
"status": "sent"
}

Docusign - make only one of two signature blocks signable

How do I make signatures in docusign behave like radio buttons (so that the user can only initial "Accept" or "Decline" on a form, for example, but not both?) Alternatively, we'd like to add a condition so only one signature is enabled at a time (that is, the user would have the choice of where to sign made for them).
You can use a Radio button group and have conditional Signature fields on a document to accomplish your use case.
Here is a sample CreateEnvelope Call.
{
"recipients": {
"signers": [
{
"email": "SignerEmail#acme.com",
"name": "Signer One",
"recipientId": 1,
"tabs":
{
"signHereTabs": [
{
"tabLabel": "ApproveSignature",
"documentId": "1",
"pageNumber": "1",
"xPosition": "159",
"yPosition": "340",
"conditionalParentLabel": "RadioGroup_1",
"conditionalParentValue": "Approve",
"tabOrder": "0",
},
{
"tabLabel": "DeclineSignature",
"documentId": "1",
"pageNumber": "1",
"xPosition": "360",
"yPosition": "339",
"conditionalParentLabel": "RadioGroup_1",
"conditionalParentValue": "Decline",
}
],
"radioGroupTabs": [
{
"documentId": "1",
"recipientId": "1",
"groupName": "RadioGroup_1",
"radios": [
{
"pageNumber": "1",
"xPosition": "119",
"yPosition": "199",
"value": "Approve",
"selected": "false",
"required": "true",
},
{
"pageNumber": "1",
"xPosition": "356",
"yPosition": "199",
"value": "Decline",
"selected": "false",
"required": "true",
}
],
}
]
}
}
]
},
"emailSubject": "Please approve or deny my document",
"documents": [
{
"documentId": "1",
"name": "Approve or Deny",
"fileExtension" : "pdf",
"documentBase64": "[Intentionally Left out]"
}
],
"status": "sent"
}

How can we add a attachment tab while creating an envelope via template using REST API?

Is there any REST API call to add a attachment tab while sending envelopes? For this I am referring to this link, but I don't know how to use this. Can you please tel me the full API call?
It's just like any other DocuSign tab, you just need to reference the name properly and set its parameters. Here's an example that would send one signature tab and one signer attachment tab:
POST v2/accounts/{accountId}/envelopes
{
"emailSubject": "Please sign this document",
"documents": [
{
"name": "test.pdf",
"documentId": "1"
}
],
"recipients": {
"signers": [
{
"tabs": {
"signHereTabs": [
{
"pageNumber": "1",
"documentId": "1",
"yPosition": "100",
"xPosition": "100",
"tabLabel": "Signature Tab",
}
],
"signerAttachmentTabs": [
{
"pageNumber": "1",
"documentId": "1",
"yPosition": "100",
"xPosition": "200",
"required": "true",
"tabLabel": "Signer Attachment Tab",
}
]
},
"routingOrder": "1",
"recipientId": "1",
"name": "Jon Dough",
"email": "jon.dough#email.com"
}
]
},
"status": "sent"
}

Resources