Pre-populating Template Tabs with REST API - docusignapi

Trying to pre-populate some fields before sending an envelope using a template in my account, but when the signer/recipient receives the link to the document in their email, the fields are left blank. Here's a portion of the JSON I'm using to make the request in the API:
var body = JSON.stringify({
"emailSubject": "DocuSign API call - Request Signature",
"templateId": templateId,
"templateRoles": [{
"email": recipientEmail,
"name": recipientName,
"roleName": templateRoleName,
"tabs": {
"companyTabs": [
{
"tabLabel": "\\*SignerCompany",
"value": recipientCompany
},
],
"titleTabs": [
{
"tabLabel": "\\*SignerTitle",
"value": recipientTitle
}
]
}
}],
"status": "sent", ....
So the company and title tabs with the labels "SignerCompany" and "SignerTitle" aren't being pre-filled for the recipient. I've tried changing font colors and other things and those seem to work, but somehow the value just doesn't.
I've viewed many similar problems with trying to pre-populate these templates but haven't been able to figure it out. Any help is much appreciated!

This was just asked (and answered) in another recent Stack Overflow post. The issue is that you can not set the company and title tabs in particular (they are read-only).
The system populates their data based on the user's account profile, so if no profile or no data in their profile they'll show up as blank as you're seeing.
See this post for a more detailed answer: https://stackoverflow.com/a/38009218/1968395

Related

POSTMan sample - creating envelope from a template is not populating the user tags

I created a DocuSign template that contains two roles: Provider and Recipient. I did this via the DocuSign Sandbox UI.
In my template, I have one document, with four tabs on it:
1. ProviderName
2. ProviderAddress1
3. RecipientName
4. RecipientAddress
Should I be using CustomFields vs. Tabs?
What's the API call(s) that I should be making to do the following, given a template with a document in it:
create an envelope for specific users
update the text within the document in the template for the specific users
send it out?
In the POSTMan sample, I tried using this URL, doing a POST:
{{baseUrl}}/envelopes
passing in a templateId, and the following JSON below in the POST body:
JSON:
{
"templateRoles": [{
"email": "{{signer1Email}}",
"name": "The Provider",
"roleName": "Provider",
"tabs": {
"textTabs": [{
"tabLabel": "ProviderName",
"value": "This is the provider!"
},
{
"tabLabel": "ProviderAddress1",
"value": "10 Provider Street, Baltimore, MD 21212"
}]
}
},
{
"email": "{{otherEmail}}",
"name": "Test Recipient",
"roleName": "Recipient",
"tabs": {
"textTabs": [{
"tabLabel": "RecipientName",
"value": "This is the recipient!"
},
{
"tabLabel": "RecipientAddress",
"value": "10 Main Street, Baltimore, MD 21212"
}]
}
}],
"emailSubject": "DocuSign API - Signature Request on Document Call",
"templateId": "<<template ID>>",
"status": "sent"
}
This does return an Envelope Id in the response, and I do receive the email with the DocuSign document to sign.
However, the tabs are NOT populated, they're blank.
Are the roles in the Template empty placeholders? If a name/email is defined on the template, the API call won't populate them as you might expect.
Try to add the documentId and pageNumber properties to your tabs. Also, ensure the label matches what is in the original template.
Lastly, you may need to add recipientId as well to each of the recipients to match what is in the template (this one may not be required since you have the roleName but just in case)

Filtering Envelopes based on a type

I have a situation where I want to be able to differentiate between envelopes based on a 'type'. For example, I'll have quotes and invoices, both of these can be sent to the same person so I'd like to know if there's a way of checking some sort of field that could differentiate the two. Currently I'm rather crudely post processing the API results and checking for 'quote' in the document type and I'd like a rather more reliable solution
thanks,
Oliver
You can use Envelope Custom Fields aka Document labels to specify additional metadata for an envelope.
Envelope Custom fields aka Document labels can be used in the envelopes for your account to record information about the envelope, help search for envelopes and track information. The envelope custom fields are not seen by the envelope recipients.
The DocuSign Web sending tool refers to the Envelope Custom fields as Document Labels. You can configure Document Labels as an Administrator on the Account. See instructions here
Once the Document labels are configured at the account level, you can provide label values for each envelope you send through the web sending tool. See instructions here
The other option is to specify Envelope Custom fields using the API. Here is a sample createEnvelope api request that specifies custom Fields associated with the envelope
{
"emailSubject": "Envelope with custom fields",
"status": "sent",
"customFields": {
"listCustomFields": [
{
"listItems": [
"sample string 1"
],
"name": "myListField",
"required": "true",
"show": "true",
"value": "MyListValue"
}
],
"textCustomFields": [
{
"name": "MyOwnTextField",
"required": "true",
"show": "true",
"value": "MyValue"
}
]
},
"recipients": {
"signers": [
{
"recipientId": 1,
"email": "kaysmith#acme.com",
"name": "kay smith",
"routingOrder": "1"
}
]
},
"documents": [
{
"documentId": "1",
"name": "Agreement",
"fileExtension": "txt",
"documentBase64": "RG9jIFRXTyBUV08gVFdP"
}
]
}
More good news: the DocuSign Sending web tool automatically enables the sender, from the web tool, to set the Envelope Custom Fields.
So if you are sending envelopes programmatically or your users are sending them, it is easy to set custom field values.

DocuSign Status Code TAB_REFERS_TO_DOCUMENT_NO_TABS_ALLOWED?

I am currently using the REST api to create an envelope containing a document and a template which I have already set up in Docusign. I get the following error on the web request and can't find this error on the status code/error list provided by DocuSign to try debug the issue. Their support person suggests I ask here..
TAB_REFERS_TO_DOCUMENT_NO_TABS_ALLOWED -- The Tab refers to a document that does not allow tabs.
Has anyone experienced this?
Edit:
The issue appears to be related to the document section.
{
"emailBlurb":"Test Email Body",
"emailSubject": "Test Email Subject",
"status" : "sent",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence" : 1,
"templateId": "b1eccee3-9c00-4cb2-8d30-0400d51dcfe0"
}],
"inlineTemplates": [
{
"sequence" : 2,
"recipients": {
"signers" : [{
"email": "usera#bah.com",
"name": "usera",
"recipientId": "1",
"roleName": "Producer"
}]
}
}],
"document": {
"documentId": 1,
"name": "Test.docx",
"documentBase64":"[bytesremoved]",
"fileExtension":"docx"
}
}]
}
So you have a template on the server, with a document as part of the template?
But you want the envelope to use a different document with the template, yes?
It is my understanding that the documentId in the document section of the composite template must match the documentId used in the template if you want the document to be substituted for the template's document.
So check the definition of the template. Did you create the template programmatically or did you use the web browser DocuSign app? If the latter, then note that the first document in a template is not always given an id of 1.

How to add sms Authentication to template roles?

Using the DocuSign Rest API I'm creating an envelope from a template that has one recipient role that has to sign. On the template creation for that recipient role I have enabled Identity Check -> SMS Auth $. It works fine when I try to sent the envelope from DocuSign portal. However when I try to sent it using the API call I get an error saying: RECIPIENT_SMS_AUTH_PHONE_MISSING: SMS authentication phone number cannot be empty.
The request body has included inside template roles:
"SmsAuthentication":{
"senderProvidedNumbers":["recipient_number"] },
"IdCheckConfigurationName":"SMS Auth $",
"RequireIdLookup":true
Is there any reason why this won't work when making the API call?
For some reason I can only get this to work by using the compositeTemplates request property (i.e. I'm unable to get it to work with just a simple Template). Note that you need to have SMS authentication enabled in the account you are testing with, if you're testing with a developer sandbox account it should be enabled, if you're in production you can reach out to your account manager.
To get this to work I used the following JSON that uses a composite template:
{
"status": "sent",
"emailSubject": "Please sign this for me",
"compositeTemplates": [{
"serverTemplates": [{
"sequence": "1",
"templateId": "[TEMPLATE_ID]"
}],
"inlineTemplates": [{
"sequence": "1",
"recipients": {
"signers": [{
"name": "[SIGNER_NAME]",
"email": "[SIGNER_EMAIL]",
"routingOrder": "1",
"requireIdLookup": true,
"recipientId": "1",
"idCheckConfigurationName": "SMS Auth $",
"smsAuthentication": {
"senderProvidedNumbers": [
"1234567890"
]
}
}]
}
}]
}]
}
I only tested with a U.S. number so not sure about the international number formats, but the above format I've included works for U.S. numbers starting with the area code.
Update
To get this to work with international numbers add the roleName property to the signers object and also add your country code (ie "+55" in this case for Brazil)
for country code, please set as form below, +84 is VN, leave one space between phone number and country code, it take me a lot of time :(
"senderProvidedNumbers": ["+84 945672509"]

Docusign API Invalid email address error with signature from document request with inPersonSigner recipient type

I'm currently testing an API call that will ultimately allow for an agent to provide signature and another party to sign in person. In sending the call via API Explorer I continue to receive the following response:
{
"errorCode": "INVALID_EMAIL_ADDRESS_FOR_RECIPIENT",
"message": "The email address for one of the recipients is not valid."
}
I've read in the REST API guide that this needs to be enabled for my account; it may be that my demo dev account does not have this enabled. I just need to verify whether or not that I'm not omitting any essential parameters in this call. I've tried passing in my email (as the account holder) and still receive this error. Here is my request body JSON:
{
"emailBlurb": "test",
"emailSubject": "test",
"documents": [
{
"name": "ChiropractorPlusApplication.pdf",
"documentId": "1"
}
],
"recipients": {
"inPersonSigners": [
{
"hostName": "Joe Host",
"recipientId": "1",
"name": "Name",
"email": "host#gmail.com",
"signerName": "Insured"
}
]
},
"status": "sent"
}
Thanks!
I believe you have found a bug with the REST API Explorer in that it's missing at least one field for In Person Signers. If you look at the REST API documentation you'll see that there's one more required parameter for In Person Signers, which is the hostEmail
Try adding to your JSON
"hostEmail" : "host's email address",
And I have a feeling that will do the trick. See page 275 of REST API v2 PDF for info on In Person Signers recipient type. It first shows a sample request with all the options then below that it lists the required fields for this recipient type:
http://www.docusign.com/sites/default/files/REST_API_Guide_v2.pdf

Resources