Auto populating all custom fields in an envelope across multiple templates - docusignapi

As outlined in the API documentation linked below
https://developers.docusign.com/docs/esign-rest-api/v2/reference/envelopes/enveloperecipienttabs/#automatically-populating-tabs
We are trying to populate custom fields (textTabs with the same tabLabel) throughout an existing envelope for a recipient on all documents using the update method (PUT). Note: We are testing this in our Dev environment
When sending the JSON body data
{
"textTabs": [
{
"value": "test",
"tabLabel": "\\*firstName"
}
]
}
Without specifying a tabID as this does not seem to be required in the included documentation provided.
We are receiving this JSON body error response.
{
"textTabs": [
{
"requireAll": "false",
"concealValueOnDocument": "false",
"disableAutoSize": "false",
"localePolicy": {},
"recipientId": "1",
"errorDetails": {
"errorCode": "INVALID_TABID",
"message": "Invalid TabId specified. TabId:not specified."
},
"tabType": "text"
}
]
}
If we do specify a tabID (which appears to be unique per DocuSign envelope) it does work for that single specified textTab within the envelope and nothing else - See below JSON body response.
{
"textTabs": [
{
"isPaymentAmount": "false",
"validationPattern": "",
"validationMessage": "",
"shared": "true",
"requireInitialOnSharedChange": "false",
"senderRequired": "false",
"requireAll": "false",
"value": "test",
"required": "false",
"locked": "false",
"concealValueOnDocument": "false",
"disableAutoSize": "false",
"maxLength": "4000",
"tabLabel": "\\*firstName",
"font": "lucidaconsole",
"bold": "false",
"italic": "false",
"underline": "false",
"fontColor": "black",
"fontSize": "size10",
"localePolicy": {},
"documentId": "2",
"recipientId": "1",
"xPosition": "20",
"yPosition": "165",
"width": "84",
"height": "22",
"tabId": "d31e1587-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"templateLocked": "false",
"templateRequired": "false",
"tabOrder": "0",
"tabType": "text"
}
]
}
Additionally if we are to use the \\* prefix as suggested in the documentation, the tabLabel is updated to "\\*firstname"
This does not seem like the correct behavior. Is anyone able to point me in the right direction? or am I interpreting something wrong here?

You have to specify a specific tab when setting tab values, there's no mechanism that I know of to do wildcard or set all tabs in one swoop.
You could make GET call(s) first to retrieve all the tabs and then set up a single call that sets them all (by iterating through all the tabs and fetching the tabId for each)
There may be one way to do this differently, but it requires that the tabs have tabLabel and if it's the same, you can set it for all tab with the same tabLabel in one call (without specifying tabId) but not sure that would work for you because I don't see that in the response when you created the tabs.

Related

Calling EnvelopesApi#update_document_tabs returns an error

I want to update all the tabs for a document at once. The document's envelope was created from a template which already has the recipients and tabs defined, and I am calling this endpoint with the following payload to update the tabs:
{
"textTabs": [
{
"validationPattern": "",
"validationMessage": "",
"shared": "false",
"requireInitialOnSharedChange": "false",
"requireAll": "false",
"value": "Some value",
"originalValue": "Original value",
"required": "false",
"locked": "true",
"concealValueOnDocument": "false",
"disableAutoSize": "false",
"maxLength": "4000",
"tabLabel": "Address",
"font": "lucidaconsole",
"fontColor": "black",
"fontSize": "size12",
"localePolicy": {},
"documentId": "1",
"recipientId": "18870af6-8c21-4e4c-934c-ac329b6f7374",
"pageNumber": "1",
"xPosition": "52",
"yPosition": "94",
"width": "132",
"height": "18",
"tabId": "032f2d80-7a93-4a7c-b969-aea2249fbd04",
"templateRequired": "false",
"tabType": "text"
}
]
}
I get the following error in response:
{
"errorCode": "INVALID_TAB_OPERATION",
"message": "The Tab specified is not valid for the requested operation. Updated tabs must all be Strikethrough or SmartSection tabs if you're not specifying a valid recipient."
}
recipientId is set to the value I received from this endpoint, but I've also tried setting it to "1" which is the recipientId I pass when creating the template.
What is the correct way to call this endpoint?
Yulian, It appears there's a bug in the UpdateDocumentTabs endpoint that is causing this issue and we're looking into it and hope to have an update soon.
As a workaround, you can use the UpdateRecipientTabs endpoint for now. I realize this would mean making additional API calls for the same purpose. If you need your API hourly quota increased - you can contact me and I can help with that.

Retrieving Custom Fields from a Template in Docusign

Hello Stack Overflow world,
I am currently trying to pull back all custom fields associated with a template I have created but I keep getting a 200 code with no data in the body. Anybody know what I am doing wrong?
Endpoint:
GET /v2/accounts/{myaccountID}/templates/{mytemplateId}/custom_fields
Headers: {"accept":"application/json", "Content-Type":"application/json"}
Response Headers:
{
"cache-control": "no-cache",
"content-length": "57",
"content-type": "application/json; charset=utf-8",
"x-ratelimit-reset": "1518814800",
"x-ratelimit-limit": "1000",
"x-ratelimit-remaining": "999",
"x-docusign-tracetoken": "{redacted}",
"date": "Fri, 16 Feb 2018 20:00:27 GMT",
"connection": "close",
"strict-transport-security": "max-age=31536000; includeSubDomains"
}
Body:
{}
The request that you've posted (GET /v2/accounts/{myaccountID}/templates/{mytemplateId}/custom_fields) will return any Envelope Custom Fields that the template contains. Envelope Custom Fields are the collection of textCustomFields and/or listCustomFields that can be used to specify metadata for the Envelope that isn't available/visible to recipients in any way. Is that truly the type of data that you're intending to retrieve?
If you're not really intending the retrieve Envelope Custom Fields (as described above), but rather, want to retrieve the tabs (fields) that are visible to recipients in the document(s) of the Envelope, then you should instead use the Get Template request:
GET /v2/accounts/{myaccountID}/templates/{mytemplateId}
The response body will contain all information for the Template, including a (top-level) recipients property that contains an array of signers. For each signer specified, the tabs property will contain the tabs (fields) that are assigned to that signer. For the example, the following JSON shows the recipients portion of a Get Template response for a template that contains a single signer who is assigned just one text tab.
{
...
"recipients": {
"signers": [
{
"tabs": {
"textTabs": [
{
"height": 33,
"isPaymentAmount": "false",
"validationPattern": "",
"validationMessage": "",
"shared": "false",
"requireInitialOnSharedChange": "false",
"requireAll": "false",
"value": "",
"originalValue": "",
"width": 60,
"required": "true",
"locked": "false",
"concealValueOnDocument": "false",
"disableAutoSize": "false",
"maxLength": 100,
"tabLabel": "Address",
"font": "lucidaconsole",
"bold": "false",
"italic": "false",
"underline": "false",
"fontColor": "black",
"fontSize": "size9",
"documentId": "92876756",
"recipientId": "72490903",
"pageNumber": "1",
"xPosition": "70",
"yPosition": "40",
"tabId": "879ff828-53d2-40af-97a7-a9b1f71a1a87",
"templateLocked": "false",
"templateRequired": "false"
}
]
},
...
}
],
...
},
...
}

texttabs not being set using rest api create envelope

Wondering what I am missing or doing wrong here as the value for the tabs are not being set when creating the envelope.
In the JSON code below I am trying to default values for the text tabs for recipient 5.
{
"emailSubject":"Allowance Agreement - AK Anne Klein Footwear - ytd .doc",
"emailBlurb":"DEV - Please complete the Vendor Allowance Agreement required for your Supplier setup with Zappos.com or 6pm.com. \n\n Please reach out to your Vendor Support team member or vendorsupport#zappos.com with any questions.",
"status":"sent",
"compositeTemplates":[
{
"compositeTemplateId": "1",
"inlineTemplates":[
{
"sequence":"1",
"documents": [
{
"documentId": "1",
"name": "Allowance Agreement - AK Anne Klein Footwear - ytd .doc.doc"
}
],
"customFields": {
"textCustomFields": [
{
"name": "Node ID",
"required": "true",
"show": "true",
"value": "658824"
}
]
},
"recipients":{
"signers":[
{
"email":"email#email.com",
"name":"v",
"recipientId":1,
"roleName":"Vendor"
},
{
"email":"email#email.com",
"name":"test",
"recipientId":2,
"roleName":"Vendor Support"
},
{
"email":"email#email.com",
"name":"ap",
"recipientId":3,
"roleName":"AP"
},
{
"email":"email#email.com",
"name":"f",
"recipientId":4,
"roleName":"Finance"
},
{
"email":"email#email.com",
"name":"ap",
"recipientId":5,
"roleName":"AP2",
"tabs":{
"textTabs":[
{
"tabLabel":"txtVendorId",
"value":"100023"
},
{
"tabLabel":"txtSupplierName",
"value":"AK Anne Klein Footwear"
},
{
"tabLabel":"txtSupplierId",
"value":"253"
}
]
}}
]
}
}
],
"serverTemplates":[
{
"sequence":"2",
"templateId":"A3B4F6BB-639A-486F-8C84-826295142F21"
}
]
}
]
}
When I look at the envelope tabs here is what I get for the 5th recipient:
"textTabs": [
{
"height": 22,
"isPaymentAmount": "false",
"validationPattern": "",
"shared": "false",
"requireInitialOnSharedChange": "false",
"requireAll": "false",
"name": "Text",
"value": "",
"width": 300,
"required": "true",
"locked": "false",
"concealValueOnDocument": "false",
"disableAutoSize": "false",
"tabLabel": "txtVendorId",
"font": "lucidaconsole",
"fontColor": "black",
"fontSize": "size9",
"documentId": "1",
"recipientId": "5",
"pageNumber": "2",
"xPosition": "217",
"yPosition": "651",
"tabId": "2179efb5-9f59-4bb7-895e-da868fba9919"
},
{
"height": 22,
"isPaymentAmount": "false",
"validationPattern": "",
"shared": "false",
"requireInitialOnSharedChange": "false",
"requireAll": "false",
"name": "Text",
"value": "",
"width": 342,
"required": "true",
"locked": "false",
"concealValueOnDocument": "false",
"disableAutoSize": "false",
"tabLabel": "txtSupplierName",
"font": "lucidaconsole",
"fontColor": "black",
"fontSize": "size9",
"documentId": "1",
"recipientId": "5",
"pageNumber": "2",
"xPosition": "172",
"yPosition": "670",
"tabId": "2c6e59b1-6a4f-4f5f-a873-33398c78e408"
},
{
"height": 22,
"isPaymentAmount": "false",
"validationPattern": "",
"shared": "false",
"requireInitialOnSharedChange": "false",
"requireAll": "false",
"name": "Text",
"value": "",
"width": 354,
"required": "true",
"locked": "false",
"concealValueOnDocument": "false",
"disableAutoSize": "false",
"tabLabel": "txtSupplierId",
"font": "lucidaconsole",
"fontColor": "black",
"fontSize": "size9",
"documentId": "1",
"recipientId": "5",
"pageNumber": "2",
"xPosition": "172",
"yPosition": "690",
"tabId": "614eb20b-5536-45db-b64a-84a475cdc44d"
}
]
* EDIT *
adding final part of envelopes tabs and screen captures of recipients and one tab...
},
"isBulkRecipient": "false",
"name": "ap",
"email": "email#email.com",
"recipientId": "5",
"recipientIdGuid": "77e255d8-a6d6-47a8-98ee-0f3829631d76",
"requireIdLookup": "false",
"userId": "8d7f443b-7adf-4cfa-8368-296aee88e959",
"routingOrder": "5",
"roleName": "AP2",
"status": "created",
"totalTabCount": "5"
}
* Workaround *
Since I was not able to set the tab values at creation time I tried the following:
Tried to create a PUT request to update the tabs using the uri for the tab for the recipient /envelopeid/recipients/5/tabs and passing the JSON for the text tabs as.
{
"textTabs":[
{
"tabLabel": "txtVendorId",
"value":"123"
}
]
}
Passing the JSON above I would get a response that the tab was not found on the envelope
{
"requireAll": "false",
"concealValueOnDocument": "false",
"disableAutoSize": "false",
"recipientId": "5",
"tabId": "00000000-0000-0000-0000-000000000000",
"errorDetails": {
"errorCode": "INVALID_TAB_OPERATION",
"message": "The Tab specified is not valid for the requested operation. The Tab specified is not valid for the requested operation. Tab not found in envelope."
}
My second step was to actually get the tabId value from the created envelope instead of using the tab lable (something that I would not have before creating the envelope).
By calling /envelopeid/recipients/5/tabs with the tabId in the JSON instead like
{
"textTabs":[
{
"tabId": "57135910-fe34-417d-a4e3-fc7d6c4a42ed",
"value":"123"
}
]
}
Then the field value got updated correctly.
In conclusion, for my workaround will need three calls to DocuSign to be able to set the default values for this recipient:
Create Envelope
Get Recipient tabs (to get value of tab ids)
Update tab values using tab ids.
Are you positive you are correctly matching your recipients to valid roles you've configured on the Template?
For instance, I see that for recipient #5 you are assigning them to the "AP2" role, does that exact role exist in your template when you login to the website and view the template?
I'm sorry for the very long delay on an answer, your JSON needs one small tweek.
You need to change your sequence of your serverTemplates to 1, assigning the values to the same template.
"serverTemplates":[
{
"sequence":"1",
}
This will remove the need for the GET/PUT (although you can still do the GET to verify information if you'd like)

Get tab values from signed_completed document

First of all, DocuSign does not have consistent name for tabs in the document. When you convert PDF into DocuSign template, they were called "fields" which are where you could input your values such as text box, radio button, and check box.
Then in DocuSign admin console, DocuSign lists or labels them as Tags. But in the API document or calls, DocuSign uses another keyword as tab.
My question is how to get all the tab value from a signed document. There is a API call to get tab value from a draft document. It may work for a signed document too. But that API is based on recipient as well.
So if a document has multiple recipients and they all can change one tab. Then once the document is signed by all recipients, how do I get the final tab value from this final document.
The key is there should be only ONE final document regardless how many signers. So I should NOT get the value from each recipient and guess whose input is the final one.
Yes you can make a single API call to get all the tab values and information from a given, completed envelope in addition to draft ones. You need to make a GET request to the URI
v2/accounts/:accountId/envelopes/:envelopeId/recipients
And you need to include the optional query parameter ?include_tabs=true
For instance, your call should look like:
GET https://demo.docusign.net/restapi/v2/accounts/...123456.../envelopes/...ABCDE.../recipients?include_tabs=true
X-DocuSign-Authentication: <DocuSignCredentials><Username>{name}</Username><Password>{password}</Password><IntegratorKey>{integrator_key}</IntegratorKey></DocuSignCredentials>
Accept: application/json
Content-Type: application/json
Sample Response for a completed envelope with 2 recipients:
{
"signers": [
{
"tabs": {
"signHereTabs": [
{
"name": "Signature",
"tabLabel": "Signature 1",
"scaleValue": 1,
"optional": "false",
"documentId": "1386280",
"recipientId": "1822485",
"pageNumber": "1",
"xPosition": "88",
"yPosition": "234",
"tabId": "07e52952-304d-42d3-8ed2-347945e8a5bb"
}
],
"textTabs": [
{
"height": 22,
"isPaymentAmount": "false",
"validationPattern": "",
"shared": "false",
"requireInitialOnSharedChange": "false",
"requireAll": "false",
"name": "Text",
"value": "recipient 1 text goes here",
"width": 120,
"required": "true",
"locked": "false",
"concealValueOnDocument": "false",
"disableAutoSize": "false",
"tabLabel": "DataField1",
"font": "arial",
"bold": "false",
"italic": "false",
"underline": "false",
"fontColor": "black",
"fontSize": "size9",
"documentId": "1386280",
"recipientId": "1822485",
"pageNumber": "1",
"xPosition": "160",
"yPosition": "261",
"tabId": "668c1395-ced9-4b17-8ee9-f495ecbf02cd"
}
],
"checkboxTabs": [
{
"name": "Checkbox",
"tabLabel": "Checkbox 1",
"selected": "true",
"shared": "false",
"requireInitialOnSharedChange": "false",
"required": "true",
"locked": "false",
"documentId": "1386280",
"recipientId": "1822485",
"pageNumber": "1",
"xPosition": "118",
"yPosition": "298",
"tabId": "c767ad9a-9ab9-464d-bf4b-4dbfd811fa98"
}
]
},
"isBulkRecipient": "false",
"name": "John Doe",
"email": "john#test.com",
"recipientId": "1822485",
"recipientIdGuid": "5cb7641f-4009-4341-ab36-7d81074e3456",
"requireIdLookup": "false",
"userId": "346a8395-6a4a-4044-87a4-77586d038bf7",
"routingOrder": "1",
"status": "completed",
"signedDateTime": "2015-03-23T19:39:39.6270000Z",
"deliveredDateTime": "2015-03-23T19:39:14.7770000Z"
},
{
"tabs": {
"signHereTabs": [
{
"name": "Signature",
"tabLabel": "Signature 2",
"scaleValue": 1,
"optional": "false",
"documentId": "1386280",
"recipientId": "1827039",
"pageNumber": "1",
"xPosition": "320",
"yPosition": "234",
"tabId": "dd733be4-6f07-4ab3-bc1f-6b46596e7faa"
}
],
"textTabs": [
{
"height": 22,
"isPaymentAmount": "false",
"validationPattern": "",
"shared": "false",
"requireInitialOnSharedChange": "false",
"requireAll": "false",
"name": "Text",
"value": "Sally's text goes here",
"width": 120,
"required": "true",
"locked": "false",
"concealValueOnDocument": "false",
"disableAutoSize": "false",
"tabLabel": "DataField2",
"font": "arial",
"bold": "false",
"italic": "false",
"underline": "false",
"fontColor": "black",
"fontSize": "size9",
"documentId": "1386280",
"recipientId": "1827039",
"pageNumber": "1",
"xPosition": "445",
"yPosition": "261",
"tabId": "7e435666-255c-4a3c-8699-be71ab6f384b"
}
],
"listTabs": [
{
"listItems": [
{
"text": "foo",
"value": "foo",
"selected": "true"
},
{
"text": "bar",
"value": "bar",
"selected": "false"
}
],
"value": "foo",
"width": 100,
"requireInitialOnSharedChange": "false",
"required": "true",
"locked": "false",
"requireAll": "false",
"tabLabel": "Drop Down 1",
"font": "arial",
"bold": "false",
"italic": "false",
"underline": "false",
"fontColor": "black",
"fontSize": "size9",
"documentId": "1386280",
"recipientId": "1827039",
"pageNumber": "1",
"xPosition": "320",
"yPosition": "301",
"tabId": "b845dde2-ba64-4905-8400-a7b795877ef2"
}
]
},
"isBulkRecipient": "false",
"name": "Sally Doe",
"email": "sally#test.com",
"recipientId": "1827039",
"recipientIdGuid": "43617294-9b97-41c2-8b90-bac4f40a0b33",
"requireIdLookup": "false",
"userId": "346a8395-6a4a-4044-87a4-77586d038bf7",
"routingOrder": "2",
"status": "completed",
"signedDateTime": "2015-03-23T19:40:43.6630000Z",
"deliveredDateTime": "2015-03-23T19:40:20.4070000Z"
}
],
"agents": [],
"editors": [],
"intermediaries": [],
"carbonCopies": [],
"certifiedDeliveries": [],
"inPersonSigners": [],
"recipientCount": "2",
"currentRoutingOrder": "1"
}
See THIS PAGE of the REST API documentation for more info on the call.

List Tabs required attribute

It doesn't appear that the Rest 2.0 API returns the required attribute for a list tab. In my example, the tab on my document is required, but the JSON returned from the API doesn't contain the required attribute:
"listTabs": [
{
"listItems": [
{
"text": "Steve",
"value": "Steve",
"selected": "true"
},
{
"text": "John",
"value": "John",
"selected": "false"
},
{
"text": "Alexa",
"value": "Alexa",
"selected": "false"
}
],
"value": "Alexa",
"width": 77,
"shared": "false",
"requireInitialOnSharedChange": "false",
"tabLabel": "Rep",
"font": "arial",
"fontSize": "size11",
"documentId": "1",
"recipientId": "86d68ea3-9aee-470a-8aed-53846ca5587d",
"pageNumber": "1",
"xPosition": "283",
"yPosition": "269",
"tabId": "e4ddc5ca-3670-417e-b4ba-ef0ce38270d1"
}
]
Am I doing something wrong, or is there a bug here? Any workarounds?
I'm able to reproduce this issue, and it seems like a bug to me. If the required property is set to true for a Drop Down list, you should be seeing "required": "true" in the "GET Recipients (with tabs)" API response body. Perhaps someone from DocuSign can chime in here to either confirm the bug, or explain the behavior.

Resources