本文介绍了仅在设置选项卡时,Docusign请求才会返回错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在转换关联文档上的PDF字段。效果很好-但我想在标签中填充值。当我修改请求时,添加标签:

I'm transforming PDF Fields on the associated Document. That works fine -- but I'd like to populate the tabs with values. When I modify the request adding tabs:

  var text = new docusign.Text();
  text.setName('BorrowerName');
  text.setValue('Grace Hooper');
  text.setLocked('true')

  var tabs = new docusign.Tabs();
  tabs.setTextTabs([text]);

  var signer = new docusign.Signer();
  signer.setEmail(signerEmail);
  signer.setName(signerName);
  signer.setRecipientId('1');
  signer.setRoleName('borrower');
  signer.setDefaultRecipient('true');
  signer.setTabs(tabs);

  var recipients = new docusign.Recipients();
  recipients.setSigners([signer]);

  var inlineTemplate = new docusign.InlineTemplate();
  inlineTemplate.setRecipients(recipients);
  inlineTemplate.setSequence('1');

  var doc = new docusign.Document();
  doc.setDocumentBase64(new Buffer(fileBytes).toString('base64'));
  doc.setName('youragreeementmiss.pdf');
  doc.setDocumentId('1');
  doc.setTransformPdfFields('true');

  var compositeTemplate = new docusign.CompositeTemplate();
  compositeTemplate.setDocument(doc);
  compositeTemplate.setInlineTemplates([inlineTemplate]);
  compositeTemplate.setServerTemplates([]);

  var envDef = new docusign.EnvelopeDefinition();
  envDef.setEmailSubject('Thou shalt sign me');
  envDef.setCompositeTemplates([compositeTemplate]);
  envDef.setStatus('sent');

我收到错误:

The request body is missing or improperly formatted. Null object cannot be converted to a value type.

感谢您的帮助:)!

我在发送请求之前捕获了该请求,以查看它是否格式错误,但看起来还不错:

I captured the request before being sent to see if it was malformed, but looks ok:

{
   "documents":[
      {
         "documentId":"1",
         "uri":null,
         "remoteUrl":null,
         "name":"youragreeementmiss.pdf",
         "password":null,
         "transformPdfFields":"true",
         "fileExtension":null,
         "matchBoxes":[

         ],
         "order":null,
         "pages":null,
         "documentFields":[

         ],
         "encryptedWithKeyManager":null,
         "documentBase64":"",
         "applyAnchorTabs":null
      }
   ],
   "recipients":{
      "signers":[
         {
            "signatureInfo":null,
            "defaultRecipient":"true",
            "tabs":{
               "signHereTabs":[

               ],
               "initialHereTabs":[

               ],
               "signerAttachmentTabs":[

               ],
               "approveTabs":[

               ],
               "declineTabs":[

               ],
               "fullNameTabs":[

               ],
               "dateSignedTabs":[

               ],
               "envelopeIdTabs":[

               ],
               "companyTabs":[

               ],
               "titleTabs":[

               ],
               "textTabs":[
                  {
                     "height":null,
                     "isPaymentAmount":null,
                     "formula":null,
                     "validationPattern":null,
                     "validationMessage":null,
                     "shared":null,
                     "requireInitialOnSharedChange":null,
                     "senderRequired":null,
                     "requireAll":null,
                     "name":null,
                     "value": "Grace Hopper",
                     "originalValue":null,
                     "width":null,
                     "required":null,
                     "locked":null,
                     "concealValueOnDocument":null,
                     "disableAutoSize":null,
                     "maxLength":null,
                     "tabLabel": "BorrowerName",
                     "font":null,
                     "bold":null,
                     "italic":null,
                     "underline":null,
                     "fontColor":null,
                     "fontSize":null,
                     "documentId":null,
                     "recipientId":null,
                     "pageNumber":null,
                     "xPosition":null,
                     "yPosition":null,
                     "anchorString":null,
                     "anchorXOffset":null,
                     "anchorYOffset":null,
                     "anchorUnits":null,
                     "anchorIgnoreIfNotPresent":null,
                     "anchorCaseSensitive":null,
                     "anchorMatchWholeWord":null,
                     "anchorHorizontalAlignment":null,
                     "tabId":null,
                     "templateLocked":null,
                     "templateRequired":null,
                     "conditionalParentLabel":null,
                     "conditionalParentValue":null,
                     "customTabId":null,
                     "mergeField":null,
                     "status":null,
                     "errorDetails":null
                  }
               ],
               "numberTabs":[

               ],
               "ssnTabs":[

               ],
               "dateTabs":[

               ],
               "zipTabs":[

               ],
               "emailTabs":[

               ],
               "noteTabs":[

               ],
               "checkboxTabs":[

               ],
               "radioGroupTabs":[

               ],
               "listTabs":[

               ],
               "firstNameTabs":[

               ],
               "lastNameTabs":[

               ],
               "emailAddressTabs":[

               ],
               "formulaTabs":[

               ]
            },
            "signInEachLocation":null,
            "offlineAttributes":null,
            "requireSignerCertificate":null,
            "requireSignOnPaper":null,
            "canSignOffline":null,
            "isBulkRecipient":null,
            "bulkRecipientsUri":null,
            "recipientSuppliesTabs":null,
            "excludedDocuments":[

            ],
            "name":"Grace",
            "email":"[email protected]",
            "emailRecipientPostSigningURL":null,
            "signingGroupId":null,
            "signingGroupName":null,
            "signingGroupUsers":[

            ],
            "recipientId":"1",
            "recipientIdGuid":null,
            "accessCode":null,
            "addAccessCodeToEmail":null,
            "requireIdLookup":null,
            "idCheckConfigurationName":null,
            "socialAuthentications":[

            ],
            "phoneAuthentication":null,
            "samlAuthentication":null,
            "smsAuthentication":null,
            "userId":null,
            "clientUserId":null,
            "embeddedRecipientStartURL":null,
            "customFields":[

            ],
            "routingOrder":null,
            "idCheckInformationInput":null,
            "recipientAttachments":[

            ],
            "note":null,
            "roleName":null,
            "status":null,
            "signedDateTime":null,
            "deliveredDateTime":null,
            "declinedDateTime":null,
            "sentDateTime":null,
            "declinedReason":null,
            "deliveryMethod":null,
            "faxNumber":null,
            "templateLocked":null,
            "templateRequired":null,
            "emailNotification":null,
            "inheritEmailNotificationConfiguration":null,
            "errorDetails":null,
            "recipientAuthenticationStatus":null,
            "totalTabCount":null
         }
      ],
      "agents":[

      ],
      "editors":[

      ],
      "intermediaries":[

      ],
      "carbonCopies":[

      ],
      "certifiedDeliveries":[

      ],
      "inPersonSigners":[

      ],
      "recipientCount":null,
      "currentRoutingOrder":null,
      "errorDetails":null
   },
   "customFields":null,
   "eventNotification":null,
   "allowRecipientRecursion":null,
   "templateId":null,
   "templateRoles":[

   ],
   "compositeTemplates":[  ],
   "accessibility":null,
   "transactionId":null,
   "status":"sent",
   "documentsUri":null,
   "recipientsUri":null,
   "asynchronous":null,
   "envelopeUri":null,
   "emailSubject":"Thou shalt sign me",
   "emailBlurb":null,
   "envelopeId":null,
   "signingLocation":null,
   "customFieldsUri":null,
   "envelopeIdStamping":null,
   "authoritativeCopy":null,
   "notification":null,
   "notificationUri":null,
   "enforceSignerVisibility":null,
   "enableWetSign":null,
   "allowMarkup":null,
   "allowReassign":null,
   "createdDateTime":null,
   "lastModifiedDateTime":null,
   "deliveredDateTime":null,
   "sentDateTime":null,
   "completedDateTime":null,
   "voidedDateTime":null,
   "voidedReason":null,
   "deletedDateTime":null,
   "declinedDateTime":null,
   "statusChangedDateTime":null,
   "documentsCombinedUri":null,
   "certificateUri":null,
   "templatesUri":null,
   "messageLock":null,
   "recipientsLock":null,
   "brandLock":null,
   "brandId":null,
   "useDisclosure":null,
   "emailSettings":null,
   "purgeState":null,
   "lockInformation":null,
   "is21CFRPart11":null,
   "isUniversalSignatureEnvelope":null
}

删除行 signer.setTabs(tabs)允许处理请求。

Removing the line signer.setTabs(tabs) allows the request to be processed.

推荐答案

我正确地构造了请求-但节点客户端用 null填充了所有空模型参数

I was correctly constructing the request -- but the node client populates all empty model parameters with null

在提交请求之前递归从信封中删除空值对我来说解决了这个问题:

Recursively stripping the nulls from the envelope before submitting the request solved this issue for me:

removeNulls = function(envelope) {
  var isArray = envelope instanceof Array;
  for (var k in envelope) {
    if (envelope[k] === null) isArray ? obj.splice(k, 1) : delete envelope[k];
    else if (typeof envelope[k] == "object") removeNulls(envelope[k]);
    if (isArray && envelope.length == k) removeNulls(envelope);
  }

  return envelope;
}

这篇关于仅在设置选项卡时,Docusign请求才会返回错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 20:24