1

Many questions address portions of my request, but I cannot seem to make a complete solution work. I have created a template on my site (it has various text fields, initial fields, and signature block). Single recipient, using anchor tags for the fields. When I take a .docx file, create an envelope via the api, I want to apply the template previously mentioned, and then prefill 4 text fields on the document/template.

Anchor tags are not placing the fields appropriately.

Any advise/suggestions?

Working request call is:

{
"documents": 
   [
   {
  "documentBase64":"<BASE64STREAM>",
  "documentId":"3",
  "fileExtension":"docx",
  "name":"10001000_20170803_FILE"
  }
   ],
   "emailSubject": "TEST - Group Audit - 10001000",
   "templateId": "TEMPLATE_ID",
   "templateRoles" : 
   [
  {
  "email": "JDOE@email.com",
  "name": "JOHN DOE",
  "roleName": "signer1",
  "tabs": 
     {
     "textTabs": 
        [
           {
           "documentId": "3",
           "recipientId": "1",
           "tabLabel": "groupname",
           "value": "TEST GROUP ONE"
           },
           {
           "documentId": "3",
           "recipientId": "1",
           "tabLabel": "groupnumber",
           "value": "10001000"
           },
           {
           "documentId": "3",
           "recipientId": "1",
           "tabLabel": "txt",
           "value": "my@email.com"
           },
           {
           "documentId": "3",
           "recipientId": "1",
           "tabLabel": "fein",
           "value": "870142380"
           },
           {
           "documentId": "3",
           "recipientId": "1",
           "tabLabel": "physicaladdress",
           "value": "1 STREET WAY, , MY CITY, CA,  98001"
           }
        ]
     }
  }
],
   "status":"sent"
}
Larry K
  • 47,808
  • 15
  • 87
  • 140
Chris Kiel
  • 13
  • 4
  • 1
    did the answer below sufficiently address your question? If it does not, please add a comment to the answer to indicate where you're still having trouble, and I'll try to help. If the answer does sufficiently address your question, can you please mark it as the "accepted" answer, so that others may benefit from this information in the future? Thanks! – Kim Brandl Aug 07 '17 at 21:46
  • I am not sure if this completely answers my question. I used composite template, but the anchor tag fields are not aligned as in the template loaded or when manually loaded via the UI. Your description and understanding of what I am doing is spot on. I just didn't know all of the correct terms to use. Still playing with the code, just not aligning properly. Please note I am traveling, so I am unable to test any further for about 10 days. However, if you have any suggestions about the field alignment, I would be happy to have your input. – Chris Kiel Aug 08 '17 at 23:14
  • So, do I understand correctly that the tabs that your template defines are each being placed in the document using "anchor text" (in the 'classic docusign UI') or "auto place" (in the 'new docusign UI')? If yes, then are you seeing different placement of tabs when you use the template to send a document via the web UI versus sending the exact same document using the API? I would expect the placement results to be exactly the same for the same document, whether sent via API or web UI. If that's true, then you need to adjust the placement specs of each tab in the template using the web UI. – Kim Brandl Aug 09 '17 at 13:35
  • The tabs on my template are being placed in the document using anchor text (classic docusign UI). Yes, I am seeing different placement of the tabs between API and web UI. If placement specs are changed in the Web UI, then the API call usage will be fixed, but the Web UI will be off. That is just substituting one error for another. – Chris Kiel Aug 21 '17 at 20:09
  • This sounds like a bug to me. i.e., if the location of tabs is specified in the Template via the web UI, then the resulting tab placement (i.e., where the recipient sees the tabs in the document) should be exactly the same regardless of whether you use the template to create a document via the web UI or via the API. I'd suggest you contact DocuSign support for help with this issue. DocuSign Support phone # in the United States is: 800-379-9973 (https://support.docusign.com/en/contactSupport). – Kim Brandl Aug 21 '17 at 20:21
  • That is what I am thinking. I'll send my Docusign rep a note about this. As a workaround for anyone else with a similar issue, I found that if I add the following 4 lines to each tag, I can "reposition" the tag to exactly where I want. Changing the X and Y offsets appropriately. "anchorUnits": "pixels", "anchorXOffset": "45", "anchorYOffset": "20", "anchorIgnoreIfNotPresent": "true" – Chris Kiel Aug 21 '17 at 22:17
  • In a roundabout way, you did help me solve the issue.. I have a working solution.... with a few hundred extra lines of code in the API call due to the number of fields. Thank you. – Chris Kiel Aug 21 '17 at 22:19
  • Glad to hear you figured out a work-around! – Kim Brandl Aug 21 '17 at 22:56

1 Answers1

2

Based on the information you've provided, I understand your scenario to be as follows:

  • You've created a template via the DocuSign UI; that template contains a 'placeholder' document (which you will replace at run-time via your Create/Send Envlope API call) and defines the recipient(s) and tabs for that document.

  • When you create/send the envelope via API, you want to specify the document as part of the API request (i.e., to be used instead of the 'placeholder' document that the DocuSign template contains) and also auto-populate some of the tabs that the template defines.

If that's an accurate description of what you're trying to achieve, then you need to use Composite Templates in the API request structure. Here's an example of a Create/Send Envelope JSON request that uses composite templates (and contains data based upon the information you provided in your question):

{
  "compositeTemplates": [
    {
      "serverTemplates": [
        {
          "sequence": "1",
          "templateId": "TEMPLATE_ID"
        }
      ],
      "inlineTemplates": [
        {
          "sequence": "2",
          "recipients": {
            "signers": [
              {
                "name": "JOHN DOE",
                "email": "JDOE@email.com",
                "roleName": "signer1",
                "tabs":
                  {
                      "textTabs":[
                        {
                            "tabLabel" : "groupname",
                            "value" : "TEST GROUP ONE" 
                        },
                        {
                            "tabLabel" : "groupnumber",
                            "value" : "10001000" 
                        },
                        {
                            "tabLabel" : "txt",
                            "value" : "my@email.com" 
                        },
                        {
                            "tabLabel" : "fein",
                            "value" : "870142380" 
                        },
                        {
                            "tabLabel" : "physicaladdress",
                            "value" : "1 STREET WAY, , MY CITY, CA,  98001" 
                        }
                      ]
                  }                 
              }
            ]
          }
        }
      ],
      "document": {
        "documentId": "3",
        "name": "10001000_20170803_FILE.docx",
        "fileExtension": "docx",
        "documentBase64": "BASE64STREAM"
      }
    }
  ],
  "status": "sent",
  "emailSubject": "TEST - Group Audit - 10001000"
}
Kim Brandl
  • 13,125
  • 2
  • 16
  • 21