Create an envelope with different visibility of documents for users - docusignapi

I generate an envelope of 10-15 documents. There are two end users, the user that will sign should not see document 1 with the data of the second user. The second is to see all the documents.
I tried to use "excludedDocuments", but I come across the error "ACCOUNT_LACKS_PERMISSIONS".
The example I am generating (incomplete)
{"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"email": "albert#princeton.edu",
"name": "Albert Einstein",
"recipientId": "1",
"clientUserId": "albert#princeton.edu",
"routingOrder": "1",
"tabs": {
"textTabs": [],
"radioGroupTabs": [],
"checkboxTabs": []
}
}
]
}
}
],
"document": {
"documentId": 1,
"name": "FirstFile",
"transformPdfFields": "true"
}
},
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"email": "albert#princeton.edu",
"name": "Albert Einstein",
"recipientId": "1",
"clientUserId": "albert#princeton.edu",
"routingOrder": "1",
"tabs": {
"textTabs": [],
"radioGroupTabs": [],
"checkboxTabs": []
}
}
]
}
}
],
"document": {
"documentId": 2,
"name": "SecondFile",
"transformPdfFields": "true"
}
}
]}
Please tell me how to solve this problem. Thank you in advance
upd PHP7 code:
$compositeTemplates[] = [
'inlineTemplates' => [
[
'sequence' => '1',
'recipients' => [
'signers' => [
[
'email' => $userData['email'],
'name' => $userData['name'],
'recipientId' => '1',
'clientUserId' => $userData['email'],
'routingOrder' => '1',
"excludedDocuments" => ['1'],
'tabs' => [
'textTabs' => Template::fileTextTabs($sendData[$withoutExtension]['text'] ?? false), //here the simple formation of tabs according to what is
'radioGroupTabs' => Template::fileRadioGroupTabs($sendData[$withoutExtension]['radio'] ?? false),
'checkboxTabs' => Template::fileCheckboxTabs($sendData[$withoutExtension]['checkbox'] ?? false),
],
],
],
"carbonCopies" => [
[
"email" => 'mylyrium#gmail.com',
"name" => 'copies',
"recipientId" => "2",
"routingOrder" => '1',
],
],
],
],
],
'document' => [
'documentId' => $id,
'name' => $filename,
'transformPdfFields' => 'true',
],
];
$id++;

This error means that the Admin account is not properly configured to have the document visibility enabled.
To do so, go to your DocuSign Admin Account and scroll down to Sending Settings.
Make sure that one of the below options is selected instead of Off
For more information on the Document Visibility drop-down options, see the official documentation

Related

Composite Template: can't prefill first tabs

Using the below code, everything works except I am only able to fill the Tabs from whatever document I attach second. Tabs from the first don't even show up on the "Form Data" list. I'm sure this is something minor that I am overlooking, but I can not see a differance between what I have and what I have seen elsewhere on this forum, and I can not find another post with this problem. Any help would be appreciated.
{
"emailSubject": "DocuSign API - Composite Test",
"status": "sent",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence": "1",
"templateId": "TEMPLATEID"
}
],
"inlineTemplates":[
{
"sequence":"1",
"recipients": {
"inPersonSigner": [
{
"hostEmail": "HOTEMAIL",
"hostName": "HOSTNAME",
"inPersonSigningType": "inPersonSigner",
"recipientId": "1",
"roleName": "Primary",
"signerName": "John Doe",
"signerEmail": "Test#Test.com",
"clientUserId": "1001"
}
]
},
"tabs": {
"textTabs": [
{
"tabLabel": "Address",
"value": "221 Cherry St"
}
]
}
}
]
},
{
"serverTemplates":[
{
"sequence": "2",
"templateId": "TEMPLATEID"
}
],
"inlineTemplates":[
{
"sequence":"2",
"recipients": {
"inPersonSigners": [
{
"hostEmail": "HOSTEMAIL",
"hostName": "HOSTNAME",
"inPersonSigningType": "inPersonSigner",
"recipientId": "1",
"roleName": "Primary",
"signerName": "John Doe",
"signerEmail": "test#test.com",
"clientUserId": "1001"
}
]
},
"tabs": {
"textTabs": [
{
"tabLabel": "ApplicantPhone",
"value": "123-456-7890"
}
]
}
}
]
}
]
}
A couple of comments about the JSON you've posted:
the property name for the inPersonSigners should be plural (in your JSON, it's singular InPersonSigner in the first composite template object)
tabs should be a property of each inPersonSigner object (in your JSON, it's a property of the inlineTemplate object)
With this feedback in mind, here's how your inPersonSigners section should be structured:
"inPersonSigners": [
{
"hostEmail": "HOSTEMAIL",
"hostName": "HOSTNAME",
"inPersonSigningType": "inPersonSigner",
"recipientId": "1",
"roleName": "Primary",
"signerName": "John Doe",
"signerEmail": "Test#Test.com",
"clientUserId": "1001",
"tabs": {
"textTabs": [
{
"tabLabel": "...",
"value": "..."
}
]
}
}
]
And, here's your entire JSON request, modified to reflect the changes I've described above:
{
"emailSubject": "DocuSign API - Composite Test",
"status": "sent",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence": "1",
"templateId": "TEMPLATEID"
}
],
"inlineTemplates":[
{
"sequence":"2",
"recipients": {
"inPersonSigners": [
{
"hostEmail": "HOSTMAIL",
"hostName": "HOSTNAME",
"inPersonSigningType": "inPersonSigner",
"recipientId": "1",
"roleName": "Primary",
"signerName": "John Doe",
"signerEmail": "Test#Test.com",
"clientUserId": "1001",
"tabs": {
"textTabs": [
{
"tabLabel": "Address",
"value": "221 Cherry St"
}
]
}
}
]
}
}
]
},
{
"serverTemplates":[
{
"sequence": "1",
"templateId": "TEMPLATEID"
}
],
"inlineTemplates":[
{
"sequence":"2",
"recipients": {
"inPersonSigners": [
{
"hostEmail": "HOSTEMAIL",
"hostName": "HOSTNAME",
"inPersonSigningType": "inPersonSigner",
"recipientId": "1",
"roleName": "Primary",
"signerName": "John Doe",
"signerEmail": "test#test.com",
"clientUserId": "1001",
"tabs": {
"textTabs": [
{
"tabLabel": "ApplicantPhone",
"value": "123-456-7890"
}
]
}
}
]
}
}
]
}
]
}

Is previewing possible composite documents without sending it out by eMail

Is it necessary to send out an eMail to recipients to fill a template with tabs?
At the moment I create an envelope with status=sent that will obviously sent the filled documents to recipients. I would not like to send the document's, when creating.
If I use status=created the preview shows just empty documents. The templates are not filled with the tabs and not send.
How can I preview, but not sent an eMail. And sent when I think I am ready. In total the recipient would just get on eMail to sign their documents.
{
"emailSubject": "DocuSign: Multi Document",
"status": "sent",
"eventNotification": {
"url": "http://fake.com",
"envelopeEvents": [
{
"envelopeEventStatusCode": "Completed"
}
],
"recipientEvents": [
{
"recipientEventStatusCode": "Completed"
}
]
},
"brandId": "11111-my-brand-id---1111",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence": 1,
"templateId": "myTemplate-id-1"
}
],
"inlineTemplates": [
{
"sequence": 1,
"recipients": {
"signers": [
{
"email": "adv+docusign#test.test",
"name": "Dev",
"recipientId": 1,
"roleName": "Advisor",
"tabs": {
"textTabs": [
{
"tabLabel": "Subscription_Amount",
"value": "100000",
"documentId": 1
}
],
"radioGroupTabs": []
}
}
]
}
}
]
},
{
"serverTemplates": [
{
"sequence": 2,
"templateId": "myTemplate-id-2"
}
],
"inlineTemplates": [
{
"sequence": 2,
"recipients": {
"signers": [
{
"email": "adv+docusign#test.test",
"name": "Dev",
"recipientId": 1,
"roleName": "Advisor",
"tabs": {
"textTabs": [
{
"tabLabel": "Subscription_Amount",
"value": "100000",
"documentId": 1
}
],
"radioGroupTabs": []
}
}
]
}
}
]
},
{
"serverTemplates": [
{
"sequence": 3,
"templateId": "myTemplate-id-3"
}
],
"inlineTemplates": [
{
"sequence": 3,
"recipients": {
"signers": [
{
"email": "other+docusign#test.test",
"name": "Dev",
"recipientId": 1,
"roleName": "Other",
"tabs": {
"textTabs": [
{
"tabLabel": "Subscription_Amount",
"value": "100000",
"documentId": 1
}
],
"radioGroupTabs": []
}
}
]
}
}
]
}
]}
Sending (short version)
{
emailSubject: 'DocuSign: Multi Document',
status: 'sent',
eventNotification:
exports {
url: 'https://host/o/fsg11/hook',
envelopeEvents: [ [Object] ],
recipientEvents: [ [Object] ] },
brandId: 'brand-id',
compositeTemplates:
[ { serverTemplates: [Object], inlineTemplates: [Object] },
{ serverTemplates: [Object], inlineTemplates: [Object] },
{ serverTemplates: [Object], inlineTemplates: [Object] } ]
}
Receiving
{
envelopeId: 'envelope-id',
status: 'sent',
statusDateTime: '2017-06-13T01:10:08.3100000Z',
uri: '/envelopes/envelope-id'
}
Please make sure the tabLabel, recipientId and documentId match the server templates values. The tabs should be created successfully once those values are correct.
You can obtain those values using the listTemplateDocuments && listTemplateRecipients apis.
For documentId
GET https://demo.docusign.net/v2/accounts/{accountId}/templates/{templateId}/documents
For tabLabel, recipientId
GET https://demo.docusign.net/v2/accounts/{accountId}/templates/{templateId}/recipients?include_tabs=true

Docusign: composite templates with tabs

How do I specify prefilled fields with composite templates when creating an envelope.
I tried including the tabs information in the inlineTemplate.recipients.signers[0].tabs, but I get an error that System.String cannot be cast to API_REST.Models.v2.tabs.
If I include information as a template role in templateRoles, it is ignored. The documentation is light on information about how to do this. It seems like the prefill data should be specified in the inline template.
Other open questions I have include what does the recipientId do. What is the clientUserIdused for? We currently set clientUserId to the same value for all signers. I see it's used when signer requests a signature. Should it be unique to every signer for some reason?
It also looks like a single composite template overlays the server and inline templates on top of each other. What's the use case for having multiple server templates or multiple inline templates in a single composite template?
Are there plans to improve the documentation to describe how to use composite templates for various purposes?
Signer/template role:
{
"clientUserId": "clientUserId",
"email": "first+last#email.com",
"name": "First Last",
"roleName": "role1",
"tabs": {
"textTabs": [
{
"locked": true,
"tabLabel": "\\*FieldName",
"value": "prefillValue"
}
]
}
}
Example request:
{
"compositeTemplates": [
{
"inlineTemplates": [
{
"recipients": {
"signers": [
{
"clientUserId": "clientUserId",
"email": "first+last#email.com",
"name": "First Last",
"recipientId": 1,
"roleName": "role1",
"tabs": {
"textTabs": [{"tabLabel": "label", "value": "val"}]
}
}
]
},
"sequence": 1
}
],
"serverTemplates": [
{
"sequence": 1,
"templateId": "templateId1"
}
]
},
{
"inlineTemplates": [
{
"recipients": {
"signers": [
{
"clientUserId": "clientUserId",
"email": "first+last#better.com",
"name": "First Last",
"recipientId": 1,
"roleName": "role1",
"tabs": {
"textTabs": [{"tabLabel": "label", "value": "val"}]
}
}
]
},
"sequence": 2
}
],
"serverTemplates": [
{
"sequence": 2,
"templateId": "templateId2"
}
]
}
],
"emailSubject": "Email subject",
"status": "sent",
"templateId": null,
"templateRoles": null
}
Information on sending an envelope from a server template can be found here.
RecipientID is used by the tab element to indicate which recipient is to sign the Document while the clientuserID specifies if the user is remote or embedded and it is recommended it be unique per signer (but not required).
I'd also suggest reading this page about composite templates, hopefully the concept will make a bit more sense but I am with you that the lack of documentation on composite templates can be troublesome.
Unfortunately, I don't have a sample with tab data included, but adding the tab section under each recipient from my sample below should work with no issues.
{
"emailSubject": "DocuSign Comp Test 1",
"emailBlurb": "Example - Composite Templates",
"status": "sent",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence": "1",
"templateId": "templateId1"
}
],
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"email": "testsigner123#gmail.com",
"name": "Test Tester",
"recipientId": "1",
"roleName": "Signer 1"
}
]
}
}
]
},
{
"serverTemplates": [
{
"sequence": "2",
"templateId": "templateId2"
}
],
"inlineTemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"email": "testsigner123#gmail.com",
"name": "Test Tester",
"recipientId": "1",
"roleName": "Signer 1"
}
]
}
}
]
},
{
"serverTemplates": [
{
"sequence": "3",
"templateId": "templateId3"
}
],
"inlineTemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"email": "testsigner123#gmail.com",
"name": "Test Tester",
"recipientId": "1",
"roleName": "Signer 1"
}
]
}
}
]
}
]
}

Docusign REST composite templates and embedded signing creates duplicate recipients

I'm having a problem creating an envelope from a composite template and having it not duplicate the recipient. Here is a sample of my call.
{
"emailSubject": "Please complete the following forms",
"status": "sent",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence": "1",
"templateId": "5ff1b987-dc38-49b1-b394-840f10ad08bb"
}
],
"inlineTemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"name": "Bob Sample",
"email": "bob.sample#example.com",
"roleName": "Client",
"clientUserId": "bob.sample#example.com",
"recipientId": "1"
}
]
}
}
]
},
{
"serverTemplates": [
{
"sequence": "1",
"templateId": "02d947aa-6320-4a6b-b4b4-79c4c733d0d0"
}
],
"inlineTemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"name": "Bob Sample",
"email": "bob.sample#example.com",
"roleName": "Client",
"clientUserId": "bob.sample#example.com",
"recipientId": "1"
}
]
}
}
]
}
]
}
When I look at the envelope it has Bob Sample twice in the signing flow. How do I make this call so that only one Bob Sample is required to sign?

How to pre-fill data tag with a date mask

I am creating an envelope using the RES API and have a tag on the document to capture a date (not the date signed, another recipient-supplied date). I can successfully pre-fill the value of this when the mask on the field is Text, but when I switch it to be Date it's blank. "DOBField" is the label of the tag below. Anyone know what I'm doing wrong here?
{
"accountId": "xxxxxx",
"emailSubject": "DocuSign API - Embedded Signing Example",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence": 1,
"templateId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx"
}
],
"inlineTemplates": [
{
"sequence": 1,
"recipients": {
"signers": [
{
"email": "123#456.com",
"name": "Rick James",
"clientUserId": "3",
"recipientId": 0,
"roleName": "Signer"
}
]
}
}
]
},
{
"serverTemplates": [
{
"sequence": 1,
"templateId": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
],
"inlineTemplates": [
{
"sequence": 1,
"recipients": {
"signers": [
{
"email": "123#456.com",
"name": "Rick James",
"clientUserId": "3",
"recipientId": 0,
"roleName": "Signer",
"tabs": {
"textTabs": [
{
"tabLabel": "DOBField",
"value": "12/24/1976"
}
]
}
}
]
}
}
]
}
],
"enableWetSign": false,
"status": "sent"
}
If you've specified mask of "Date" for the field, then it's no longer a textTab -- it's now a dateTab. So, try changing textTabs to dateTabs in your API request. i.e., the tabs portion of the request will look like this:
"tabs": {
"dateTabs": [
{
"tabLabel": "DOBField",
"value": "12/24/1976"
}
]
}

Resources