0
votes

We have had code using the DocuSign C# API in production for well over a year now, including some that successfully excludes documents from some recipients but not others. Now, on a new envelope type, I am getting the above error and can't figure out why. Below are the lightly edited/anonymized JSON request payload and DocuSign response with the error (both captured with Fiddler).

As you can see, there are three documents and two signers, with both signers getting document id 1, and one signer being excluded from document id 2 and the other signer excluded from document id 3. There are also two carbon copy recipients who are both internal employees on our account. For what it's worth, the Document Visibility setting on the account is "Must sign to view, unless a member of sender's account."

Here is the JSON payload being sent to DocuSign to create the envelope:

{
  "documents": [
    {
      "documentId": "1",
      "name": "Document1",
      "fileExtension": "pdf",
      "order": "1",
      "documentBase64": "blahblahblah"
    },
    {
      "documentId": "2",
      "name": "Document2",
      "fileExtension": "pdf",
      "order": "2",
      "documentBase64": "blahblahblah"
    },
    {
      "documentId": "3",
      "name": "Document2",
      "fileExtension": "pdf",
      "order": "3",
      "documentBase64": "blahblahblah"
    }
  ],
  "recipients": {
    "signers": [
      {
        "tabs": {
          "signHereTabs": [
            {
              "name": "Joe Smith",
              "tabLabel": "Signature1",
              "scaleValue": "0.9",
              "documentId": "1",
              "recipientId": "1",
              "anchorString": "Some anchor text",
              "anchorXOffset": "4",
              "anchorYOffset": "46",
              "anchorMatchWholeWord": "true",
              "tabId": "Signature1"
            },
            {
              "name": "Joe Smith",
              "tabLabel": "Signature2",
              "documentId": "2",
              "recipientId": "1",
              "anchorString": "Some other anchor text",
              "anchorXOffset": "4",
              "anchorYOffset": "67",
              "anchorMatchWholeWord": "true",
              "tabId": "Signature2"
            }
          ],
          "dateSignedTabs": [
            {
              "tabLabel": "DateSigned1",
              "documentId": "1",
              "recipientId": "1",
              "anchorString": "Some anchor text",
              "anchorXOffset": "175",
              "anchorYOffset": "38",
              "anchorMatchWholeWord": "true",
              "tabId": "DateSigned1"
            }
          ],
          "textTabs": []
        },
        "recipientSuppliesTabs": "false",
        "excludedDocuments": [ "3" ],
        "name": "Joe Smith",
        "email": "[email protected]",
        "emailRecipientPostSigningURL": "https://www.foocorp.com/e-consent-complete/",
        "recipientId": "1",
        "customFields": [],
        "routingOrder": "1",
        "roleName": "Signer",
        "emailNotification": {
          "emailSubject": "Joe Smith has documents from Foo Corp",
          "emailBody": "Blah blah blah"
        }
      },
      {
        "tabs": {
          "signHereTabs": [
            {
              "name": "Bob Jones",
              "tabLabel": "Signature1",
              "scaleValue": "0.9",
              "documentId": "1",
              "recipientId": "2",
              "anchorString": "Some anchor text",
              "anchorXOffset": "277",
              "anchorYOffset": "46",
              "anchorMatchWholeWord": "true",
              "tabId": "Signature1"
            },
            {
              "name": "Bob Jones",
              "tabLabel": "Signature3",
              "documentId": "3",
              "recipientId": "2",
              "anchorString": "Some other anchor text",
              "anchorXOffset": "4",
              "anchorYOffset": "67",
              "anchorMatchWholeWord": "true",
              "tabId": "Signature3"
            }
          ],
          "dateSignedTabs": [
            {
              "tabLabel": "DateSigned1",
              "documentId": "1",
              "recipientId": "2",
              "anchorString": "Some anchor text",
              "anchorXOffset": "448",
              "anchorYOffset": "38",
              "anchorMatchWholeWord": "true",
              "tabId": "DateSigned1"
            }
          ],
          "textTabs": []
        },
        "recipientSuppliesTabs": "false",
        "excludedDocuments": [ "2" ],
        "name": "Bob Jones",
        "email": "[email protected]",
        "emailRecipientPostSigningURL": "https://www.foocorp.com/e-consent-complete/",
        "recipientId": "2",
        "customFields": [],
        "routingOrder": "1",
        "roleName": "Signer",
        "emailNotification": {
          "emailSubject": "Bob Jones has documents from Foo Corp",
          "emailBody": "Blah blah blah"
        }
      }
    ],
    "carbonCopies": [
      {
        "name": "Sue Employee",
        "email": "[email protected]",
        "emailRecipientPostSigningURL": "https://www.foocorp.com/e-consent-complete/",
        "recipientId": "3",
        "customFields": [],
        "routingOrder": "1",
        "roleName": "Internal",
        "emailNotification": {
          "emailSubject": "Joe Smith has documents from Foo Corp",
          "emailBody": "Blah blah blah"
        }
      },
      {
        "name": "Sam Employee",
        "email": "[email protected]",
        "emailRecipientPostSigningURL": "https://www.foocorp.com/e-consent-complete/",
        "recipientId": "4",
        "customFields": [],
        "routingOrder": "1",
        "roleName": "Internal",
        "emailNotification": {
          "emailSubject": "Joe Smith has documents from Foo Corp",
          "emailBody": "Blah blah blah"
        }
      }
    ],
    "certifiedDeliveries": []
  },
  "status": "created",
  "emailSubject": "Joe Smith has documents from Foo Corp",
  "emailBlurb": "Blah blah blah",
  "allowMarkup": "false",
  "allowReassign": "false",
  "recipientsLock": "true",
  "emailSettings": {
    "replyEmailAddressOverride": "[email protected]",
    "replyEmailNameOverride": "Sue Employee"
  }
}

And here is the HTTP response:

HTTP/1.1 400 Bad Request
Cache-Control: no-cache
Content-Length: 177
Content-Type: application/json; charset=utf-8
X-RateLimit-Reset: 1519927200
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 997
X-DocuSign-TraceToken: deadbeef-dead-beef-dead-beefdeadbeef
Date: Thu, 01 Mar 2018 17:25:01 GMT
Strict-Transport-Security: max-age=31536000; includeSubDomains

{
  "errorCode": "CANNOT_EXCLUDE_DOCUMENT",
  "message": "This document cannot be excluded for this recipient. Recipient: Joe Smith cannot be excluded from Document:"
}

Any direction appreciated.

Edited to show that the excluded documents both share the same name because it's a "logical name" to me, e.g., "W9" that I use in combination with custom fields on the document to then route to the right place in doc management when it comes back via a Connect call. If I send document id 2 and 3 with different names, then it all works. But exclusions work by document id, not document name, so why would that matter?

Edit #2: I was able to prove to myself that it doesn't matter what the document name is - whether they're the same or different, I get the error.

1
Weird, I tried your JSON request and it worked for me : { "envelopeId": "aa66541c-1b65-4057-b97f-e0272d16cfcf", "uri": "/envelopes/aa66541c-1b65-4057-b97f-e0272d16cfcf", "statusDateTime": "2018-03-01T19:39:44.1570000Z", "status": "created" }Frederic
It IS weird. I find the API as a whole quite well designed (except for one small part) and this is only the second time I've been "surprised." I was going against the demo site, since this is still in test - was yours against demo or production?Dullroar
I tried against the demo environment. But I can try the Production oneif you want. I use this feature myself in all of my transactions and I've never come across this issue.Frederic
@Frederic, would you please? I think it is not going to change your results, but I am trying to eliminate variables. I, too, use this feature in another place in the same project with no problem. I will also be doing some more testing on my own today, to see if I can figure it out. It's a strange one!Dullroar
Actually, I just realized that I don't have a production account. But my customers use this feature fine in Production and actually confirmed that such a JSON request will work in production. Is it the exact message you're sending ?Frederic

1 Answers

1
votes

When you use Anchor string then DocuSign searches for that anchor string on complete envelope and anchors are not at document scope instead anchors are on envelope scope. So if you have same two documents added into the envelope then DocuSign will find the anchor string in both the documents and will assign DS Tabs on both documents to the recipients. Now since you are using same documents twice, so DS Tabs from both documents will be assigned to the recipient and excludedDocuments will not make sense in this scenario.