问题
I know there exists an question similar to the one which I am going to ask but that question was asked 4 years back and no concrete answer is given. Link for the question is here
I am creating an envelope using existing template and everything works smooth as butter. But, when I try to pre fill tabs value in template, tabs values are not being added to envelope. I have tried two different JSON requests, one with tabId and one with tabLabel. None of them worked.
Try 1:
{
"status":"sent",
"emailSubject":"Testing with DocuSign",
"templateId":"124faf68-3b42-43b9-9b6d-814d465e161d",
"templateRoles":
[{
"roleName":"Climber",
"name":"xyz",
"email":"temp@email.com",
"clientUserId":"126789",
"tabs":{
"fullNameTabs":[{
"tabId":"bb56d91a-1665-4817-99a6-643c67defbc1",
"value":"abc"
}],
"companyTabs":[{
"tabId":"ba5p67cb-bcf5-42b0-aa04-a0cfec448ddc",
"value":"Temporary companyname"
}]
}
}]
}
Try 2:
{
"status":"sent",
"emailSubject":"Testing with DocuSign",
"templateId":"124faf68-3b42-43b9-9b6d-814d465e161d",
"templateRoles":
[{
"roleName":"Climber",
"name":"xyz",
"email":"temp@email.com",
"clientUserId":"126789",
"tabs":{
"fullNameTabs":[{
"tabLabel":"CustomField1",
"value":"abc"
}],
"companyTabs":[{
"tabLabel":"Company 2fdbb190-2f3e-4d39-8202-e15b9a1c332a,
"value":"Temporary companyname"
}]
}
}]
}
Can someone tell me if I am doing wrong.
回答1:
You cannot prepopulate FullNameTab, EmailTab, CompanyTab, TitleTab
using API call. FullName
and Email
tabs get populated automatically when your recipient starts the signing process, DocuSign knows the signers name and email as you have set these values as below:
"name":"xyz",
"email":"temp@email.com"
CompanyTab
and TitleTab
is automatically added by DocuSign if the recipient has any DocuSign account and there values are present in their user profile. If not, then these tabs will be text field and signers can type their company name and titles.
So if you want to prepopulate anything then you need to use TextTabs
, and then you can populate values to those text tabs using JSON request using tablabel.
回答2:
To populate tab values via a Create Envelope request, you'll need to use the compositeTemplates
structure within the request body. Here's an example of that request structure that uses the data you provided in your post -- but populates a single textTab
, instead of the companyTab
and fullnameTab
. As Amit mentioned in his post, the companyTab
and fullnameTab
cannot be set via the API.
POST https://demo.docusign.net/restapi/v2/accounts/ACCOUNT_NUMBER/envelopes
{
"status" : "sent",
"emailSubject": "Testing with DocuSign",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence" : 1,
"templateId": "124faf68-3b42-43b9-9b6d-814d465e161d"
}],
"inlineTemplates": [
{
"sequence" : 2,
"recipients": {
"signers" : [{
"roleName": "Climber",
"name": "xyz",
"email": "temp@email.com",
"clientUserId": "126789",
"recipientId": "1",
"tabs": {
"textTabs": [
{
"tabLabel": "field1",
"value": "field-1-value"
}
]
}
}]
}
}]
}]
}
来源:https://stackoverflow.com/questions/47717359/passing-template-tabs-value-while-creating-envelope