Add existing recipient tabs to new document - docusignapi

I'm using DocuSign's rest API to add recipient signing tabs to documents using anchor strings (For example, 'DevSignHere'). But if we add another document later for the same recipient with the same anchor strings, DocuSign doesn't add those tabs on those anchor strings.
How can I tell DocuSign to 'look again' for anchor strings?

Once you have added a new document then you need to call below API for the recipient to create new Tabs on the new document:
POST /v2/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/tabs
DS Docs
Example:
POST /restapi/v2/accounts/<accountId>/envelopes/<envelopeId>/recipients/1/tabs
{
"dateSignedTabs": [
{
"anchorString": "\\D1\\",
"recipientId": "1",
"tabLabel": "internal_date"
}
],
"signHereTabs": [
{
"anchorString": "\\S1\\",
"recipientId": "1",
"tabLabel": "internal_sign"
}
],
"textTabs": [
{
"anchorString": "\\T1\\",
"recipientId": "1",
"tabLabel": "internal_contact"
}
]
}

If the new document's fields (Tabs) are managed by a template, then you can use Composite Templates to have the document "processed" by the right template. Ask this as a new question if you want to investigate this route.

Related

Set data fields on the document / template, for all users to see as Read-only

I have a Word document that serves as the Document template. It only has an outline on it. I then added text fields to the template.
for example, the template JSON, it looks like this:
"recipients":
{ ...
"signers": [
{ ...
"tabs":
{
"listTabs": [
{
"documentId": "1",
"pageNumber": "1",
"recipientId": "55177519",
"tabType": "list",
"tabLabel": "##parentf2e8b853-3ef1-4872-af19-4f1e3c60a3a7##recipient",
"listItems": [
{
"text": "Dealer",
"value": "Dealer"
},
{
"text": "Customer",
"value": "Customer"
}
],
"required": "true",
"shared": "true",
"value": ""
}
],
"textTabs": [
{
"documentId": "1",
"height": "19",
"pageNumber": "1",
"recipientId": "55177519",
"tabId": "55ab5a10-54d6-4ca0-a66b-7c637c8ad61a",
...
"tabLabel": "DealerPhone",
...
},
My questions are:
How can I get all of the text fields to display the data, no matter who the recipient is- for example, the DealerPhone above? Under "Collaboration", I have set the fields set to "Recipients can Collaborate".
Once the first user selects the user from the drop-down list (the listTab below), I do not want subsequent users to go in and change that selection, but I do need the users to see who the previous / first user selected in that drop-down list.
I can share JSON files of both the template and what I'm sending to create the envelope. The template displays, but the text data is blank.
Sample JSON request body:
{
"email": "...email....",
"name": "Test Dealer",
"roleName": "Dealer",
"tabs": {
"textTabs": [
{
"tabLabel": "DealerPhone",
"value": "1-800-111-2222"
},
{
"tabLabel": "DealerContact",
"value": "Billy Dealer"
}]
}
}],
"emailSubject": "DocuSign API - TEST!!!",
"templateId": "{{templateId}}",
"status": "sent"
}
There's an account-level setting that's relevant here, available from Go to Admin > Sending Settings > When an envelope is sent, write the initial value of the field for all recipients. With that enabled, all pre-populated data will be visible to all recipients. With that disabled, data only gets 'burned in' to the PDF when the assigned recipient completes their role.
If you do not want later recipients to be able to change the value of the dropdown, you will want to disable Collaboration on it. Later signers will be able to see that selection regardless of if Collaboration is enabled or not.
Finally, you'll want to avoid using Conditional Logic on fields that should always appear. Setting a tag to be a conditional child means that it will only appear if circumstances are met.
If recipients sign sequentially (increasing routing order) then every subsequent recipient can see the tabs that prior recipients have filled and they cannot modify them. If you have all tabs assigned to your first recipient, all the other recipients will see them but they'll be read-only for them.

Send envelope to another recipient

I am trying to send a DocuSign envelope, that has already been sent to a customer (not signed yet), to another or a new customer. This is slightly different from resending the contract, but the same envelope is being resent to a new contact.
Is this possible? I have tried all sorts of things, like change the recipient details to new contact, add new sender to the existing recipient details.
The document is sent to the original sender fine, but to the new sender, the tab information is missing and the sign here tab is not there.
Replacing the original recipient :
The original recipient can be replaced with a new recipient using the UpdateEnvelopeRecipients api.
The original recipient will no longer have access to the envelope.
PUT /v2/accounts/{accountId}/envelopes/{envelopeId}/recipients
{
"signers": [
{
"recipientId": 1,
"email": "newsigner#acme.com",
"name": "New Signer",
}
]
}
Adding a new recipient: To add a new recipient in addition to the existing recipients, use the CreateEnvelopeRecipients api.
POST /v2/accounts/{accountId}/envelopes/{envelopeId}/recipients
{
"signers": [
{
"recipientId": 2,
"email": "newsigner#acme.com",
"name": "New Signer"
}
]
}
To Add tabs to the new recipient, use the CreateEnvelopeRecipientTabs api. Make sure you specify the recipientId correctly in the Url.
POST /v2/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/tabs
{
"signHereTabs": [
{
"documentId": "1",
"pageNumber": "1",
"xPosition": "120",
"yPosition": "120",
}
]
}

Docusign add recipient with tabs after envelope is sent

I can create an envelope with recipients with tabs. I can also create an envelope, add additional recipients, then add tabs to those recipients. This takes two requests, (1) add recipient, (2) add tab to recipient. I can't get Docusign to add a recipient and tabs dynamically in one call. I've started by trying to get it to work using the REST API Explorer:
PostEnvelopeRecipients
Which results in the following request:
{
"signers": [
{
"clientUserId": "1234",
"email": "testuser6#example.com",
"name": "tab testuser6",
"recipientId": "1234",
"tabs": {
"signHereTabs": [
{
"documentId": "1",
"pageNumber": "1",
"xPosition": "200",
"yPosition": "200"
}
]
}
}
]
}
This results in a recipient being added to the envelope properly, however it does not have any tabs. How can I add tabs when creating a recipient after the envelope is already created in one call?
It is not possible to add Tabs using the PostEnvelopeRecipients or PutEnvelopeRecipients api. After an envelope is created/sent, two separate calls are required to add recipients and tabs.

Docusign signing url - Showing document 1 of a composite template

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.

Two Templates in One Envelope with DocuSign API

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

Resources