docusign / docusign-esign-java-client

The Official Docusign Java Client Library used to interact with the eSignature REST API. Send, sign, and approve documents using this client.
https://javadoc.io/doc/com.docusign/docusign-esign-java/latest/index.html
MIT License
104 stars 95 forks source link

How to pre-fill tab of template? #237

Open dijiehuang opened 1 year ago

dijiehuang commented 1 year ago

I want to send an envelope via the template, but the pre-fill tab doesn't work, interface error:

Message: Error while requesting server, received a non successful HTTP code 400 with response Body: '{"errorCode":"REQUIRED_TAB_INCOMPLETE","message":"A Required field is incomplete. TabId: bce12361-40b1-4d4d-908a-8b549e2eb0b9"}'

Dump: com.docusign.esign.client.ApiException: Error while requesting server, received a non successful HTTP code 400 with response Body: '{"errorCode":"REQUIRED_TAB_INCOMPLETE","message":"A Required field is incomplete. TabId: bce12361-40b1-4d4d-908a-8b549e2eb0b9"}' at com.docusign.esign.client.ApiClient.invokeAPI(ApiClient.java:1493) at com.docusign.esign.api.EnvelopesApi.createEnvelope(EnvelopesApi.java:925) at com.docusign.esign.api.EnvelopesApi.createEnvelope(EnvelopesApi.java:866) at com.docusign.controller.eSignature.services.SigningViaEmailService.signingViaEmail(SigningViaEmailService.java:33) at com.docusign.controller.eSignature.examples.EG002ControllerSigningViaEmail.doWork(EG002ControllerSigningViaEmail.java:61) at com.docusign.core.controller.AbstractController.create(AbstractController.java:86) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at...

My code is : TemplateRole signer = new TemplateRole(); signer.setEmail(signerEmail); signer.setName(signerName); signer.setRoleName("甲方");

Tabs tabs = new Tabs();
PrefillTabs prefillTabs = new PrefillTabs();
List<Text> textTabs = new ArrayList<>();
Text text = new Text();
text.setValue("djdj");
text.setTabLabel("a5045fac-9679-498a-a73c-6c255dfccc49");
text.setDocumentId("1");
text.setPageNumber("1");

textTabs.add(text);
prefillTabs.setTextTabs(textTabs);
tabs.setPrefillTabs(prefillTabs);
signer.setTabs(tabs);
......

then we invoke "envelopesApi.createEnvelope(accountId, envelope);" error

image

LarryKlugerDS commented 1 year ago

I'm reasonably sure that this operation is not supported. "pre-fill" tabs (fields) are used when a human sender of the envelope transaction wants to fill in the tabs before the envelope is sent.

But when your application is sending the envelope, your application is not a human. Instead, your application can set the value and locked attributes of a regular tab. Doing so will set the tab's value and will make the tab read-only for all of the signers. This is effectively a "pre-fill" pattern for your application.

Here is a live example of setting a template's tab value via the API Request Builder. Note how the locked tabs become read-only tabs.

pablomdstest commented 1 year ago

Case Number: xxxx

Hello,

Thank you for contacting DocuSign Customer Support regarding pre fill tabs.

Actually this is a quite big theme I have been learning, here are a couple of assets I found on this:

First this post showing an example and what to void and do in c#:

https://stackoverflow.com/questions/69994597/pre-filled-senders-tabs-on-a-template

And here an example:

"textTabs": [ { "xPosition": "15", "yPosition": "17", "value": "This tab will be filled." } ]

Another example:

this: "tabs":{             "prefillTabs":{                "textTabs":[                   {                      "anchorString":"\res.name.0\",                      "anchorYOffset":"-4",                      "locked":true,                      "value":"Michelle Dennis"                   }                ]

Should literally be it. 

Here a couple of comments from our most experienced supporters:

 Pre-filled tabs has been a big case driver lately. Bottom line you cannot add these in a create envelope call and you cannot update with a composite template call.

On the other side, other suggest; most of the time when a customer is trying to use a pre-fill tab, they should be using a text tab with a value set. This is just a point of view.

Here an official document:

https://developers.docusign.com/docs/esign-rest-api/esign101/concepts/tabs/prefilled-tabs/

A note on this:

Also prefill tabs aren't to be used like that, pre-fill tabs mean the value isn't known when the envelope is generated, but the sender should be filling it. ​​​​​​​ Let's check on this, and if you have any other question let me know.   Best regards,

Pablo | DocuSign Customer Support docusign.com Available Tuesday-Saturday 13:00-21:00 GMT-6

dijiehuang commented 1 year ago

Case Number: xxxx

Hello,

Thank you for contacting DocuSign Customer Support regarding pre fill tabs.

Actually this is a quite big theme I have been learning, here are a couple of assets I found on this:

First this post showing an example and what to void and do in c#:

https://stackoverflow.com/questions/69994597/pre-filled-senders-tabs-on-a-template

And here an example:

"textTabs": [ { "xPosition": "15", "yPosition": "17", "value": "This tab will be filled." } ]

Another example:

this: "tabs":{             "prefillTabs":{                "textTabs":[                   {                      "anchorString":"\res.name.0\",                      "anchorYOffset":"-4",                      "locked":true,                      "value":"Michelle Dennis"                   }                ]

Should literally be it. 

Here a couple of comments from our most experienced supporters:

 Pre-filled tabs has been a big case driver lately. Bottom line you cannot add these in a create envelope call and you cannot update with a composite template call.

On the other side, other suggest; most of the time when a customer is trying to use a pre-fill tab, they should be using a text tab with a value set. This is just a point of view.

Here an official document:

https://developers.docusign.com/docs/esign-rest-api/esign101/concepts/tabs/prefilled-tabs/

A note on this:

Also prefill tabs aren't to be used like that, pre-fill tabs mean the value isn't known when the envelope is generated, but the sender should be filling it.​​​​​​​Let's check on this, and if you have any other question let me know.   Best regards,

Pablo | DocuSign Customer Support docusign.com Available Tuesday-Saturday 13:00-21:00 GMT-6

@pablomdstest In this way, I still don't know how to edit template to configure prefill tabs on the website of appdemo.docusign.com ? Could you give me some screenshots ? Thank you!

dijiehuang commented 1 year ago

I'm reasonably sure that this operation is not supported. "pre-fill" tabs (fields) are used when a human sender of the envelope transaction wants to fill in the tabs before the envelope is sent.

But when your application is sending the envelope, your application is not a human. Instead, your application can set the value and locked attributes of a regular tab. Doing so will set the tab's value and will make the tab read-only for all of the signers. This is effectively a "pre-fill" pattern for your application.

Here is a live example of setting a template's tab value via the API Request Builder. Note how the locked tabs become read-only tabs.

@LarryKlugerDS Thank you for your reply. Could you tell me how to edit template to configure prefill tabs on the website of appdemo.docusign.com ?