简体   繁体   中英

DocuSign API: Signing issues with sending multiple documents in the same envelope

Using C#, DocuSign API SDK 4.5.2.

I'm sending out 3 documents for signatures in the same envelope. Each document will use the same server template (which just places the signature elements over the document using anchor tags). I can send out the envelope and I get the email back from DocuSign to view/sign the documents.

The issue I'm having is when I go to sign, I have to sign each document 3 times -- 9 times total -- before I'm allowed to click the Finish button. There is only 1 place to sign on each document, but I have to click the sign button 3 times before it's accepted. If I have 2 recipients, it's the same for each of them. If I change the code to send out only 1 document, it works fine so it's obvious something is not being generated correctly in the envelope request.

I have also tried giving each recipient a different Id number even though there are only 2 roles and 2 distinct names/email addresses.

Right before I call the API to actually send the document, I capture the JSON for debugging purposes:

{
  "compositeTemplates": [
    {
      "compositeTemplateId": "1",
      "document": {
        "documentBase64": "---Document 1 Bytes---",
        "documentId": "1",
        "fileExtension": "pdf",
        "name": "MultiDocument1"
      },
      "inlineTemplates": [
        {
          "recipients": {
            "signers": [
              {
                "email": "client@gmail.com",
                "name": "Client Name",
                "recipientId": "1",
                "roleName": "Signer1"
              },
              {
                "email": "advisor@gmail.com",
                "name": "Advisor Name",
                "recipientId": "2",
                "roleName": "Advisor"
              }
            ]
          },
          "sequence": "2"
        }
      ],
      "serverTemplates": [
        {
          "sequence": "1",
          "templateId": "99321CB1-A3E8-44A0-BDF4-D4F20069BC7B"
        }
      ]
    },
    {
      "compositeTemplateId": "2",
      "document": {
        "documentBase64": "---Document 2 Bytes---",
        "documentId": "2",
        "fileExtension": "pdf",
        "name": "MultiDocument2"
      },
      "inlineTemplates": [
        {
          "recipients": {
            "signers": [
              {
                "email": "client@gmail.com",
                "name": "Client Name",
                "recipientId": "1",
                "roleName": "Signer1"
              },
              {
                "email": "advisor@gmail.com",
                "name": "Advisor Name",
                "recipientId": "2",
                "roleName": "Advisor"
              }
            ]
          },
          "sequence": "2"
        }
      ],
      "serverTemplates": [
        {
          "sequence": "1",
          "templateId": "99321CB1-A3E8-44A0-BDF4-D4F20069BC7B"
        }
      ]
    },
    {
      "compositeTemplateId": "3",
      "document": {
        "documentBase64": "---Document 3 Bytes---",
        "documentId": "3",
        "fileExtension": "pdf",
        "name": "MultiDocument3"
      },
      "inlineTemplates": [
        {
          "recipients": {
            "signers": [
              {
                "email": "client@gmail.com",
                "name": "Client Name",
                "recipientId": "1",
                "roleName": "Signer1"
              },
              {
                "email": "advisor@gmail.com",
                "name": "Advisor Name",
                "recipientId": "2",
                "roleName": "Advisor"
              }
            ]
          },
          "sequence": "2"
        }
      ],
      "serverTemplates": [
        {
          "sequence": "1",
          "templateId": "99321CB1-A3E8-44A0-BDF4-D4F20069BC7B"
        }
      ]
    }
  ],
  "emailSubject": "Multiple Documents for Signature",
  "status": "Sent"
}

Here's one of the documents I'm using. The other 2 are similar -- different text, but using the same anchor tags.

在此处输入图像描述

I've also tried substituting another document I have used successfully in testing for Document 1 -- it is completely different, but still uses the same anchor tags. I'm getting the same results -- having to sign each signature 3 times.

Can anyone see what I'm doing wrong? If you need more information, please let me know.

thanks, randy

Update: As suggested by Inbar and Larry, I contacted DocuSign Support and had the "Anchor Population Scope" setting changed from "Envelope" to "Document". Unfortunately, this made things worse. I still have to click the signature element multiple times to sign, but only the first document can be signed. The other documents do not have any signature elements attached.

Update #2: I'm wondering if the way I'm using templates might be confusing and causing these issues. I probably should have explained myself clearer. The server template I'm using has a "dummy" Word document that just contains a common set of anchor tags for signatures and dates. I uploaded it as a template and assigned the signature and date UI elements to the anchor tags. But when I'm sending a request from my application, I'm using a different document I choose/generate at runtime. This document replaces the dummy Word document in the template, but has the same anchor tags so all the signature & date elements find their places on the real document. This works great when sending out just 1 document, but I can't get things to work for more than one.

Update #3: Requirements -- We are adding digital signature capability to our website (ASP.NET, WinForms). We already have a page where an Advisor can either print out a document for a physical signature or start a digital signature process with DocuSign. All our documents come from MS Report Server because they need to contain Client data from our database. We currently do not send out any static documents. In the code behind on the page, I get the PDF bytes from Report Server and add that (as a document) to a composite template to be sent to DocuSign. It also contains a reference to a server template in my account of a Word document (see below) containing the anchor tags and signature elements (mentioned in Update #2) to be overlaid on the Report Server document. What happens is the Report Server document replaces the text of the Word template (like a form background) and because I'm using the same text as anchor tags, the signature elements on the Word template find their match on the Report Server document and move to their positions on the document. I finally include 1 or more names/email addresses of the Clients and usually 2 other required signers (Advisor and Manager). This is then sent to DocuSign (SDK API) to start the signing process. Using a single document, this is working well. We are preparing for when we will need to send more than 1 document to a Client and we'd like to do that in a single request. If you need more info, please let me know. 服务器端Word模板

I believe the problem is that your account is set so that anchor tab positioning works across all of the documents in the envelope, not just the one document that you're applying the template to.

So you're ending up with three signing fields, positioned directly on top of one-another.

Suggestions for fixing:

  1. Only apply the last template.
  2. Or have your account changed so anchor positioning only affects the document the template is applied to.

DocuSign Customer Service put me in touch with a Developer Support Representative who was VERY patient and helpful. I explained what I was trying to do and he was able to come up with a solution which was very easily integrated into my existing codebase.

To get this to work, you need 2 pieces of the puzzle. The first item was mentioned above: you must have the Anchor Population Scope value in your account set to "Document". This has to be done by a DocuSign Customer Service rep as the setting is not user accessible.

The second item was what was contributing to the signature tags all being stacked on the first document. In your Composite Template, the Inner Template must have a sequence number of "1" and the Server Template must use a sequence number of "2". Once both of these items were in place, I could send out multiple documents each using the same server template (to define AutoPlace tags and roles) to multiple signers in a single envelope.

Here's the sample JSON which works for me:

  {
  "compositeTemplates": [
    {
      "compositeTemplateId": "1",
      "inlineTemplates": [
        {
          "documents": [
            {
              "documentBase64": "<PDF Bytes>",
              "documentId": "1",
              "fileExtension": "PDF",
              "name": "MultiDocument1"
            }
          ],
          "recipients": {
            "signers": [
              {
                "email": "client@email.com",
                "name": "Client Name",
                "recipientId": "1",
                "roleName": "Signer1"
              },
              {
                "email": "advisor@email.com",
                "name": "Advisor Name",
                "recipientId": "2",
                "roleName": "Advisor"
              }
            ]
          },
          "sequence": "1"
        }
      ],
      "serverTemplates": [
        {
          "sequence": "2",
          "templateId": "1234xxxx-xxxx-xxxx-xxxx-xxxxxxxx5678"
        }
      ]
    },
    {
      "compositeTemplateId": "2",
      "inlineTemplates": [
        {
          "documents": [
            {
              "documentBase64": "<PDF Bytes>",
              "documentId": "2",
              "fileExtension": "PDF",
              "name": "MultiDocument2"
            }
          ],
          "recipients": {
            "signers": [
              {
                "email": "client@email.com",
                "name": "Client Name",
                "recipientId": "1",
                "roleName": "Signer1"
              },
              {
                "email": "advisor@email.com",
                "name": "Advisor Name",
                "recipientId": "2",
                "roleName": "Advisor"
              }
            ]
          },
          "sequence": "1"
        }
      ],
      "serverTemplates": [
        {
          "sequence": "2",
          "templateId": "1234xxxx-xxxx-xxxx-xxxx-xxxxxxxx5678"
        }
      ]
    },
    {
      "compositeTemplateId": "3",
      "inlineTemplates": [
        {
          "documents": [
            {
              "documentBase64": "<PDF Bytes>",
              "documentId": "3",
              "fileExtension": "PDF",
              "name": "MultiDocument3"
            }
          ],
          "recipients": {
            "signers": [
              {
                "email": "client@email.com",
                "name": "Client Name",
                "recipientId": "1",
                "roleName": "Signer1"
              },
              {
                "email": "advisor@email.com",
                "name": "Advisor Name",
                "recipientId": "2",
                "roleName": "Advisor"
              }
            ]
          },
          "sequence": "1"
        }
      ],
      "serverTemplates": [
        {
          "sequence": "2",
          "templateId": "1234xxxx-xxxx-xxxx-xxxx-xxxxxxxx5678"
        }
      ]
    }
  ],
  "emailSubject": "Multiple Documents for Signatures",
  "status": "Sent"
}

If you have any questions, please let me know. Thanks to Larry K and Inbar Gazit for the assist!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM