Reputation: 2215
I am trying to set conditional rule for checkbox, such that when the checkbox is "Checked", the document can be signed. I am able to do in the template in DocuSign(see pic - Setting the conditional rule on checkbox)
When the checkbox is checked, the signature tab (and date-signed tab) will enable.
When I am trying to implement this in code, I am not able to set any conditional rule over the checkbox.
SignHere signHere = new SignHere();
signHere.setTabLabel("signHere");
signHere.setDocumentId("1");
signHere.setPageNumber("1");
signHere.setXPosition("113");
signHere.setYPosition("620");
signHere.setConditionalParentLabel("checkbox");
signHere.setConditionalParentValue("Checked");
DateSigned dateSigned = new DateSigned();
dateSigned.setDocumentId("1");
dateSigned.setPageNumber("1");
dateSigned.setXPosition("403");
dateSigned.setYPosition("630");
Checkbox checkbox = new Checkbox();
checkbox.setDocumentId("1");
checkbox.setPageNumber("1");
checkbox.setXPosition("130");
checkbox.setYPosition("564");
checkbox.setRequired("true");
checkbox.setTabLabel("checkbox");
Where am I going wrong?
Upvotes: 3
Views: 1361
Reputation: 49114
Here is a live example of a required checkbox for an envelope. The example uses the API Request Builder tool.
There's also a live example of requiring one of multiple checkboxs
The tool can output code for the DocuSign eSign API SDKs using C#, Java, PHP, Node.js, Python, and Ruby
Here's the JSON for one required checkbox
{
"emailSubject": "Please sign the attached document",
"status": "sent",
"documents": [
{
"filename": "anchorfields.pdf",
"name": "Example document",
"fileExtension": "pdf",
"documentId": "1"
}
],
"recipients": {
"signers": [
{
"email": "[email protected]",
"name": "Signer's name",
"recipientId": "1",
"clientUserId": "1000",
"tabs": {
"signHereTabs": [
{
"anchorString": "/sig1/",
"anchorXOffset": "20",
"anchorUnits": "pixels"
}
],
"checkboxTabs": [
{
"anchorString": "/sig1/",
"anchorXOffset": "180",
"anchorUnits": "pixels",
"tabGroupLabels": [
"checkbox group"
]
}
],
"tabGroups": [
{
"groupLabel": "checkbox group",
"groupRule": "SelectAtLeast",
"minimumRequired": "1",
"maximumAllowed": "1",
"validationMessage": "Please check to indicate your agreement",
"tabScope": "document",
"pageNumber": "1",
"documentId": "1"
}
]
}
}
]
}
},
Upvotes: 1
Reputation: 11
Change this line
signHere.setConditionalParentValue("Checked");
to
signHere.setConditionalParentValue("on");
Upvotes: 1
Reputation: 6818
A sample JSON code for this would be like below, I think you need to put conditionalParentValue to be "on"
instead of "checked"
{
"documents": [{
"documentBase64": "<Base64>",
"documentId": "12345",
"fileExtension": "txt",
"name": "f4506t"
}],
"emailBlurb": "Email Blurb",
"emailSubject": "Email Subject",
"recipients": {
"signers": [
{
"email": "[email protected]",
"name": "DS SSO",
"recipientId": "1",
"tabs": {
"checkboxTabs": [{
"tabLabel": "Checkbox1",
"conditionalParentLabel": null,
"conditionalParentValue": null,
"pageNumber": 1,
"documentId": "12345",
"xPosition": 168,
"yPosition": 123
}],
"initialHereTabs": [
{
"conditionalParentLabel": "Checkbox1",
"conditionalParentValue": "on",
"documentId": "12345",
"pageNumber": "1",
"tabLabel": "Initial1",
"xPosition": "300",
"yPosition": "500",
"optional": "true"
}
],
"signHereTabs": [
{
"conditionalParentLabel": "Checkbox1",
"conditionalParentValue": "on",
"documentId": "12345",
"pageNumber": "1",
"tabLabel": "Sign1",
"xPosition": "500",
"yPosition": "400"
}
],
"dateSignedTabs": [{
"tabLabel": "Date Signed1",
"conditionalParentLabel": "Checkbox1",
"conditionalParentValue": "on",
"pageNumber": 1,
"documentId": "12345",
"xPosition": 239,
"yPosition": 198
}]
}
}
]
},
"status": "sent"
}
Upvotes: 3