1

I'm trying to send an envelope from a template using the REST API. I'm using Java with XML since the Java example is given with XML only. Here: http://iodocs.docusign.com/APIWalkthrough/requestSignatureFromTemplate

My template is very simple. It has: 1. A data field called Material1 2. A data field called Quantity1 3. A Full Name field 4. Signature field 5. Date Signed field

Here's the screen shot: Template screen shot

The Java code I'm using is exactly as it appears in the API Walkthrough link that I provided above. The XML that I supply is:

<envelopeDefinition xmlns="http://www.docusign.com/restapi">
 <accountId>ZZZZZZZZZZ</accountId>
 <status>sent</status>
 <emailSubject>DocuSign API Call - Signature request from template
 </emailSubject>
 <templateId>1886EC14-153E-4E05-AFF8-04F508098E60</templateId>
 <templateRoles>
  <templateRole>
   <name>Michael</name>
   <email>michael@company.com</email>
   <roleName>Signer1</roleName>
   <tabs>
    <textTabs>
     <text>
      <tabLabel>\*Material1</tabLabel>
      <value>MTX80HD</value>
     </text>
     <text>
      <tabLabel>\*Quantity1</tabLabel>
      <value>11</value>
     </text>
    </textTabs>
   </tabs>
  </templateRole>
 </templateRoles>
</envelopeDefinition>

However the value of MTX80HD is not being prefilled in the Material1 Field, nor do I see 11 in the Quantity1. I've read multiple posts here and followed every suggestion that I have found but still can't get the pre population to work. The Full Name and Date Sign are filled in however.

TIA

Edit 1: OK. I converted the XML to JSON, as @ergin suggested below and the fields are still not prepopulated. So the issue must lie elsewhere and not with XML.

Here's the JSON I'm sending:

{"account":"MyAccountId","status":"sent","emailSubject":"DocuSign API Call - Test signature request from template","templateId":"1886EC14-153E-4E05-AFF8-04F508098E60","templateRoles":[{"name":"Michael","email":"michael@company.com","roleName":"Signer1","tabs":{"textTabs":[{"tabLabel":"Material1","value":"MTX80HD"}]}}]}
The URL I'm sending the above JSON to is: https://demo.docusign.net/restapi/v2/accounts/MyAccountId/envelopes

The fields I'm trying to populate with the tabs were created on the template as Data Field widgets.

I must be missing something obvious, as I see people posting that they got it to work, eventually. Hope to hear from anyone who has any ideas.

Thanks.

LostAndConfused
  • 157
  • 2
  • 3
  • 15

1 Answers1

0

Do you have multiple tabs that are using the same tabLabel or just one? You only need the escape sequence when you have multiple, however even then you need an extra backslash (). You have this

<tabLabel>\*Material1</tabLabel>

But it should be this instead:

<tabLabel>\\*Material1</tabLabel>

However if you only have one tab with the name Material1 then don't use \\* at all.

Also, if you want to use JSON instead you can look at some of the other API walkthroughs in other languages that show JSON, or you can use the auto-generated REST API help page:

https://www.docusign.net/restapi/help

Ergin
  • 9,254
  • 1
  • 19
  • 28
  • Hi Ergin. Thanks for the reply. I believe I only have a single tab. However, reading replies from Kim on this forum I saw her include those anyway at times. :) And since things are still not working for me I decided to try that as well. :) I noticed that you are suggesting JSON as the answer. Does that mean XML will not work? I see my template image in the Original Post didn't make it, as I need 10 rep points to post images. :( Thanks. Rudy – LostAndConfused Jan 23 '15 at 17:57
  • Hmm no it should work with XML as well, but have you tried using JSON as a test? – Ergin Jan 30 '15 at 22:51
  • Thanks @Ergin. Tried it with JSON as well, but with the same result. :( – LostAndConfused Feb 02 '15 at 16:25