I know that I can do the following using PDF field transform and a composite template (I'm actually using the C# SDK so the actually JSON isn't as important as knowing this is possible using the SDK) to have a recipient sign all signature tabs on a PDF form (not a DocuSign template) whose names start with PrimarySigner
"tabs":{
"signHereTabs":[
{
"tabLabel":"PrimarySigner\\*"
}
]
Suppose that a document has three sets of signature fields. Signer one gets PrimarySigner, Signer two gets SecondarySigner and depending on the context of the envelope Signer one or Signer two might get TertiarySigner. In the case of Signer one getting those signature fields can I add multiple wildcards for a signer? e.g. :
"tabs":{
"signHereTabs":[
{
"tabLabel":"PrimarySigner\\*"
}
],
"signHereTabs":[
{
"tabLabel":"TertiarySigner\\*"
}
]
}
UPDATE: I've implemented this, I thought, using the C# SDK. However, the signature tags are just disappearing for both signers; when they view the documents they are getting the free form rather than the directed signing experience. The PDF document I'm sending has two PDF signature fields named DocuSignSignHere_Signer1_1 and DocuSignSignHere_Signer2_1. I've double checked the obvious such as setting TransformPDFFields, etc. Wildcards will be respected on either end of the pdf form field names, yes?
Here is the JSON of the serialized envelope.
{
"compositeTemplates":[
{
"inlineTemplates":[
{
"documents":[
{
"documentBase64":"redacted",
"documentId":"1",
"name":"TestPDFForm.pdf",
"transformPdfFields":"true"
}
],
"recipients":{
"signers":[
{
"email":"test#test.com",
"name":"Test Signer 1",
"recipientId":"1",
"tabs":{
"signHereTabs":[
{
"tabLabel":"DocuSignSignHere_Signer1\\*"
}
]
}
},
{
"email":"test2#test.com",
"name":"Test Signer 2",
"recipientId":"2",
"tabs":{
"signHereTabs":[
{
"tabLabel":"DocuSignSignHere_Signer2\\*"
}
]
}
}
]
},
"sequence":"1"
}
]
}
],
"customFields":{
"textCustomFields":[
{
"name":"ClientId",
"value":"A:1!!D:1!!T:1!!UserId:123!!C:10BD32B131C5ECE3"
}
]
},
"documents":[
],
"emailSubject":"Test Email",
"eventNotification":{
"envelopeEvents":[
{
"envelopeEventStatusCode":"completed"
}
],
"includeCertificateOfCompletion":"true",
"includeCertificateWithSoap":"false",
"includeDocumentFields":"true",
"includeSenderAccountAsCustomField":"true",
"includeTimeZone":"true",
"requireAcknowledgment":"true",
"signMessageWithX509Cert":"false",
"url":"https://test.test.com/documentcallback.aspx",
"useSoapInterface":"false"
},
"status":"sent"
}
Yes you can assign multiple fields with WildCards to a single Signer.
In your example, you should move the wild card prefix (\\*) at the beginning of the tabLabel. Also you can move the signHereTabs into a single array.
Here is a sample PostEnvelope request. See full example here
POST /v2/accounts/{accountId}/envelopes
{
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"name": "Jane Doe",
"email": "janedoe#acme.com",
"recipientId": "1",
"tabs": {
"signHereTabs": [
{
"tabLabel": "\\*PrimarySigner"
},
{
"tabLabel": "\\*TertiarySigner"
}
]
}
},
{
"name": "Bob Doe",
"email": "BobDoe#acme.com",
"recipientId": "2",
"tabs": {
"signHereTabs": [
{
"tabLabel": "\\*SecondarySigner"
}
]
}
}
]
}
}
],
"document": {
"documentId": "1",
"name": "Doc with Fields",
"transformPdfFields": "true",
"fileExtension": "pdf",
"documentBase64": ""
}
}
],
"emailSubject": "Doc with form fields",
"status": "sent",
}
Related
I am able to send a POST request to send an existing template for signing. What I'm trying to do now is attach a PDF to the signature template. The attached PDF does not need to be signed / is not a template. It is just a PDF copy of a document as an appendix to the contract.
The request is going through ok, but I'm getting the error: "TAB_PAGENUMBER_IS_NOT_IN_DOCUMENT",\r\n "message": "The pagenumber specified in the tab element is not in the document that the tab refers to. Tab on Page 8 of Document 1 for Recipient 1"
JSON:
{
"emailSubject": "Please sign this document set",
"templateId": "xxxxxxx",
"templateRoles": [
{
"email": "email#example.com",
"roleName": "Buyer",
"name": "Buyer Name"
}
],
"documents": [
{
"signerMustAcknowledge": "no_interaction",
"order": "asc",
"name": "MyCompany Quote",
"includeInDownload": true,
"documentId": "2",
"documentBase64": "<base64string>",
"display": "inline"
},
],
"status": "sent"
}
How to attach a document to an online template?
The error you are seeing is because DocuSign will try to replace the document in the template with the file you are providing.
You should be able to add this additional document by using composite templates instead. https://developers.docusign.com/docs/esign-rest-api/how-to/request-signature-composite-template-embedded/
Here is a sample:
{
"compositeTemplates": [
{
"compositeTemplateId": "1",
"inlineTemplates": [
{
"recipients": {
"signers": [
{
"email": "email#example.com",
"roleName": "Buyer",
"name": "Buyer Name"
}
]
},
"sequence": "1"
}
],
"serverTemplates": [
{
"sequence": "1",
"templateId": "xxxxxxx"
}
]
},
{
"compositeTemplateId": "2",
"document": {
"documentBase64": "<base64string>",
"documentId": "2",
"fileExtension": "pdf",
"name": "MyCompany Quote"
},
"inlineTemplates": [
{
"sequence": "1"
}
]
}
],
"emailSubject": "Please sign this document set",
"status": "sent"
}
The first composite template is used to populate your existing template with the signers information. The second composite template is where you add the additional document you want your users to sign. You can also include additional tabs inside the inlineTemplates if they are needed in the future
What I want is to place the custom fields at document level while creating the template so that later I can have unique values for every envelope that is created. These values should be visible to all the recipients.
These are the steps that I currently follow:
Create Document Custom Fields/Tab Definitions at the Account level.
Create the template from our app and navigate to DocuSign to place the above created custom fields on the document (it is signer specific).
Save the template.
At a later stage, choose the template in our app and create an envelope with the template ID, templateRoles (with custom fields' values for signer), status etc. like below:
{
"templateId": "1e6c1118-1234-1244-1244-c4a11111775b",
"templateRoles": [
{
"roleName": "Signer1",
"name": "Signer1",
"email": "Signer1#Signer1.com",
"tabs": {
"textTabs": [
{
"tabLabel": "Account.Name",
"value": "account-name777"
},
{
"tabLabel": "Candidate.FullName",
"value": "candidate-name1234"
},
{
"tabLabel": "Candidate.Mobile",
"value": "0412347777"
}
]
}
},
{
"roleName": "Signer2",
"name": "Signer2",
"email": "Signer2#Signer2.com",
"tabs": {
"textTabs": [
{
"tabLabel": "Account.Name",
"value": "account-name777"
},
{
"tabLabel": "Candidate.FullName",
"value": "candidate-name1234"
},
{
"tabLabel": "Candidate.Mobile",
"value": "0412347777"
}
]
}
}
],
"status": "sent"
}
The above works for Signer1 but does not show the custom fields' values to Signer2. The custom fields need to be exactly the same for all recipients. Is there a way to achieve this?
Also what I noticed was after Signer1 signs the document then the custom fields' values show to Signer2.
Change the tabLabels so they are not the same, here is the code:
{
"templateId": "1e6c1118-1234-1244-1244-c4a11111775b",
"templateRoles": [
{
"roleName": "Signer1",
"name": "Signer1",
"email": "Signer1#Signer1.com",
"tabs": {
"textTabs": [
{
"tabLabel": "Account.Name1",
"value": "account-name777"
},
{
"tabLabel": "Candidate.FullName1",
"value": "candidate-name1234"
},
{
"tabLabel": "Candidate.Mobile1",
"value": "0412347777"
}
]
}
},
{
"roleName": "Signer2",
"name": "Signer2",
"email": "Signer2#Signer2.com",
"tabs": {
"textTabs": [
{
"tabLabel": "Account.Name2",
"value": "account-name777"
},
{
"tabLabel": "Candidate.FullName2",
"value": "candidate-name1234"
},
{
"tabLabel": "Candidate.Mobile2",
"value": "0412347777"
}
]
}
}
],
"status": "sent"
}
This is my JSON code so far:
{
"status": "sent",
"emailSubject": "This is an api Demo Doc, sent for signature",
"recipients": {
"carbonCopies": [
{
"email": "nila#gmail.com",
"name": "Nilashree",
"recipientId": "2"
}
],
"signers": [
{
"email": "{{signer1Email}}",
"name": "Nilashree Nandkumar shirodkar",
"recipientId": "1"
}
]
},
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"email": "nshiro2#students.towson.edu",
"name": "Nila Joseph",
"recipientId": "1",
"defaultRecipient": "true"
}
]
}
}
],
"documents": {
"documentId": "1",
"name": "application_form.pdf",
"transformPdfFields": "true",
"documentBase64": "{{}}"
}
}
]
}
But I am getting the following error:
"errorCode": "ENVELOPE_IS_INCOMPLETE",
"message": "The Envelope is not Complete. A Complete Envelope Requires Documents, Recipients, Tabs, and a Subject Line."
Can anyone please let me know what am I doing wrong?
Why are you using a composite template? Perhaps you are planning towards a later, more complicated envelope definition.
Your mistake is that each composite template can optionally contain only one document. The field name is document, not documents.
Instead of
"documents": {
"documentId": "1",
"name": "application_form.pdf",
"transformPdfFields": "true",
"documentBase64": "{{}}"
}
use
"document": {
"documentId": "1",
"name": "application_form.pdf",
"transformPdfFields": "true",
"documentBase64": "{{}}"
}
Also, I don't believe there's a need for the recipients outside of the composite templates structure. I'm not 100% sure about this issue though.
Many questions address portions of my request, but I cannot seem to make a complete solution work. I have created a template on my site (it has various text fields, initial fields, and signature block). Single recipient, using anchor tags for the fields. When I take a .docx file, create an envelope via the api, I want to apply the template previously mentioned, and then prefill 4 text fields on the document/template.
Anchor tags are not placing the fields appropriately.
Any advise/suggestions?
Working request call is:
{
"documents":
[
{
"documentBase64":"<BASE64STREAM>",
"documentId":"3",
"fileExtension":"docx",
"name":"10001000_20170803_FILE"
}
],
"emailSubject": "TEST - Group Audit - 10001000",
"templateId": "TEMPLATE_ID",
"templateRoles" :
[
{
"email": "JDOE#email.com",
"name": "JOHN DOE",
"roleName": "signer1",
"tabs":
{
"textTabs":
[
{
"documentId": "3",
"recipientId": "1",
"tabLabel": "groupname",
"value": "TEST GROUP ONE"
},
{
"documentId": "3",
"recipientId": "1",
"tabLabel": "groupnumber",
"value": "10001000"
},
{
"documentId": "3",
"recipientId": "1",
"tabLabel": "txt",
"value": "my#email.com"
},
{
"documentId": "3",
"recipientId": "1",
"tabLabel": "fein",
"value": "870142380"
},
{
"documentId": "3",
"recipientId": "1",
"tabLabel": "physicaladdress",
"value": "1 STREET WAY, , MY CITY, CA, 98001"
}
]
}
}
],
"status":"sent"
}
Based on the information you've provided, I understand your scenario to be as follows:
You've created a template via the DocuSign UI; that template contains a 'placeholder' document (which you will replace at run-time via your Create/Send Envlope API call) and defines the recipient(s) and tabs for that document.
When you create/send the envelope via API, you want to specify the document as part of the API request (i.e., to be used instead of the 'placeholder' document that the DocuSign template contains) and also auto-populate some of the tabs that the template defines.
If that's an accurate description of what you're trying to achieve, then you need to use Composite Templates in the API request structure. Here's an example of a Create/Send Envelope JSON request that uses composite templates (and contains data based upon the information you provided in your question):
{
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence": "1",
"templateId": "TEMPLATE_ID"
}
],
"inlineTemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"name": "JOHN DOE",
"email": "JDOE#email.com",
"roleName": "signer1",
"tabs":
{
"textTabs":[
{
"tabLabel" : "groupname",
"value" : "TEST GROUP ONE"
},
{
"tabLabel" : "groupnumber",
"value" : "10001000"
},
{
"tabLabel" : "txt",
"value" : "my#email.com"
},
{
"tabLabel" : "fein",
"value" : "870142380"
},
{
"tabLabel" : "physicaladdress",
"value" : "1 STREET WAY, , MY CITY, CA, 98001"
}
]
}
}
]
}
}
],
"document": {
"documentId": "3",
"name": "10001000_20170803_FILE.docx",
"fileExtension": "docx",
"documentBase64": "BASE64STREAM"
}
}
],
"status": "sent",
"emailSubject": "TEST - Group Audit - 10001000"
}
I am trying to use the docusign-node-client to send an envelope using the createEnvelope class. This class sends a REST API request to the /envelopes endpoint. The envelope I am trying to send contains a Composite Template.
Here is the body I am attempting to send to docusign
{
"emailSubject": "Sent from Node SDK",
"emailBlurb": "Email body here",
"customFields": {
"textCustomFields": [
{
"name": "DSFSSourceObjectId",
"required": false,
"show": false,
"value": "dealIdHere"
}
]
},
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"documents": [
{
"documentBase64": "base64StringHere",
"documentId": "1",
"fileExtension": ".pdf",
"name": "filename.pdf"
}
],
"envelope": {
"emailBlurb": "Email body here",
"emailSubject": "Sent from Node SDK",
"customFields": {
"textCustomFields": [
{
"name": "DSFSSourceObjectId",
"required": false,
"show": false,
"value": "dealIdHere"
}
]
},
"recipients": {
"signers": [
{
"email": "myEmail#domain.com",
"name": "My Name",
"recipientId": "1"
}
]
}
}
}
],
"serverTemplates": [
{
"sequence": "1"
}
]
}
],
"status": "sent"
}
When I send this body I get the following error: "The request contained at least one invalid parameter. Invalid value specified for \'templateId\' in composite template sequence: 1"
If I remove the serverTemplates array, I get this error: "The Envelope is not Complete. A Complete Envelope Requires Documents, Recipients, Tabs, and a Subject Line."
If I include a valid templateId in the serverTemplate object it creates an envelope successfully.
The as is application I am converting to Node JS used the Docusign SOAP API and is able to send composite templates with 1 to many documents. Each of these documents can be associated to their own document template or no docusign template.
Does docusign not accept composite templates without some sort of reference to a template id?
You are specifying the inlineTemplate.envelope property incorrectly. You can define the recipients and custom fields directly within the inlineTemplate. You do not have to specify the emailSubject/emailBlurb within the inlineTemplate.
Also note that the custom fields specified at the root level will be ignored when using composite templates. See this answer
The following json should work for you.
{
"emailSubject": "Sent from Node SDK",
"emailBlurb": "Email body here",
"status": "sent"
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"documents": [
{
"documentBase64": "base64StringHere",
"documentId": "1",
"fileExtension": ".pdf",
"name": "filename.pdf"
}
],
"customFields": {
"textCustomFields": [
{
"name": "DSFSSourceObjectId",
"required": false,
"show": false,
"value": "dealIdHere"
}
]
},
"recipients": {
"signers": [
{
"email": "myEmail#domain.com",
"name": "My Name",
"recipientId": "1"
}
]
}
}
]
}
]
}