【问题标题】:texttabs not being set using rest api create envelope未使用 rest api 设置 texttabs 创建信封
【发布时间】:2016-01-12 19:08:14
【问题描述】:

想知道我在这里遗漏了什么或做错了什么,因为在创建信封时没有设置选项卡的值。

在下面的 JSON 代码中,我尝试为收件人 5 的文本选项卡设置默认值。

{
            "emailSubject":"Allowance Agreement - AK Anne Klein Footwear  -  ytd .doc",
            "emailBlurb":"DEV - Please complete the Vendor Allowance Agreement required for your Supplier setup with Zappos.com or 6pm.com. \n\n Please reach out to your Vendor Support team member or vendorsupport@zappos.com with any questions.",
            "status":"sent",
            "compositeTemplates":[
            {
                "compositeTemplateId": "1",                    
                "inlineTemplates":[
                    {
                        "sequence":"1",
                         "documents": [
                            {
                            "documentId": "1",
                            "name": "Allowance Agreement - AK Anne Klein Footwear  -  ytd .doc.doc"
                            }
                            ],
                        "customFields": {
                                "textCustomFields": [
                                    {
                                        "name": "Node ID",
                                        "required": "true",
                                        "show": "true",
                                        "value": "658824"
                                    }
                                ]
                            },
                        "recipients":{
                        "signers":[
                            {
                                "email":"email@email.com",
                                "name":"v",
                                "recipientId":1,
                                "roleName":"Vendor"
                            },
                            {
                                "email":"email@email.com",
                                "name":"test",
                                "recipientId":2,
                                "roleName":"Vendor Support"
                            },
                            {
                                "email":"email@email.com",
                                "name":"ap",
                                "recipientId":3,
                                "roleName":"AP"
                            },
                            { 
                                "email":"email@email.com",
                                "name":"f",
                                "recipientId":4,
                                "roleName":"Finance"
                            },
                            {
                                "email":"email@email.com",
                                "name":"ap",
                                "recipientId":5,
                                "roleName":"AP2",
                                "tabs":{
                               "textTabs":[
                                  {
                                     "tabLabel":"txtVendorId",
                                     "value":"100023"
                                  },
                                  {
                                     "tabLabel":"txtSupplierName",
                                     "value":"AK Anne Klein Footwear"
                                  },
                                  {
                                     "tabLabel":"txtSupplierId",
                                     "value":"253"
                                  }
                               ]
                        }}
                        ]
                    }                    
                    }
                    ],
                "serverTemplates":[
                    {
                        "sequence":"2",
                        "templateId":"A3B4F6BB-639A-486F-8C84-826295142F21"
                    }
                    ]
                }
            ]
            }

当我查看信封标签时,这是我为第五个收件人得到的:

"textTabs": [
      {
        "height": 22,
        "isPaymentAmount": "false",
        "validationPattern": "",
        "shared": "false",
        "requireInitialOnSharedChange": "false",
        "requireAll": "false",
        "name": "Text",
        "value": "",
        "width": 300,
        "required": "true",
        "locked": "false",
        "concealValueOnDocument": "false",
        "disableAutoSize": "false",
        "tabLabel": "txtVendorId",
        "font": "lucidaconsole",
        "fontColor": "black",
        "fontSize": "size9",
        "documentId": "1",
        "recipientId": "5",
        "pageNumber": "2",
        "xPosition": "217",
        "yPosition": "651",
        "tabId": "2179efb5-9f59-4bb7-895e-da868fba9919"
      },
      {
        "height": 22,
        "isPaymentAmount": "false",
        "validationPattern": "",
        "shared": "false",
        "requireInitialOnSharedChange": "false",
        "requireAll": "false",
        "name": "Text",
        "value": "",
        "width": 342,
        "required": "true",
        "locked": "false",
        "concealValueOnDocument": "false",
        "disableAutoSize": "false",
        "tabLabel": "txtSupplierName",
        "font": "lucidaconsole",
        "fontColor": "black",
        "fontSize": "size9",
        "documentId": "1",
        "recipientId": "5",
        "pageNumber": "2",
        "xPosition": "172",
        "yPosition": "670",
        "tabId": "2c6e59b1-6a4f-4f5f-a873-33398c78e408"
      },
      {
        "height": 22,
        "isPaymentAmount": "false",
        "validationPattern": "",
        "shared": "false",
        "requireInitialOnSharedChange": "false",
        "requireAll": "false",
        "name": "Text",
        "value": "",
        "width": 354,
        "required": "true",
        "locked": "false",
        "concealValueOnDocument": "false",
        "disableAutoSize": "false",
        "tabLabel": "txtSupplierId",
        "font": "lucidaconsole",
        "fontColor": "black",
        "fontSize": "size9",
        "documentId": "1",
        "recipientId": "5",
        "pageNumber": "2",
        "xPosition": "172",
        "yPosition": "690",
        "tabId": "614eb20b-5536-45db-b64a-84a475cdc44d"
      }
    ]

* 编辑 * 添加信封选项卡的最后部分和收件人的屏幕截图和一个选项卡...

},
  "isBulkRecipient": "false",
  "name": "ap",
  "email": "email@email.com",
  "recipientId": "5",
  "recipientIdGuid": "77e255d8-a6d6-47a8-98ee-0f3829631d76",
  "requireIdLookup": "false",
  "userId": "8d7f443b-7adf-4cfa-8368-296aee88e959",
  "routingOrder": "5",
  "roleName": "AP2",
  "status": "created",
  "totalTabCount": "5"
}

* 解决方法 *

由于我无法在创建时设置选项卡值,因此我尝试了以下方法:

  1. 尝试创建一个 PUT 请求以使用收件人 /envelopeid/recipients/5/tabs 的选项卡的 uri 更新选项卡,并将文本选项卡的 JSON 传递为。

    { “文本标签”:[ { "tabLabel": "txtVendorId", “价值”:“123” } ] }

通过上面的 JSON,我会得到一个在信封上找不到标签的响应

{
  "requireAll": "false",
  "concealValueOnDocument": "false",
  "disableAutoSize": "false",
  "recipientId": "5",
  "tabId": "00000000-0000-0000-0000-000000000000",
  "errorDetails": {
    "errorCode": "INVALID_TAB_OPERATION",
    "message": "The Tab specified is not valid for the requested operation.  The Tab specified is not valid for the requested operation. Tab not found in envelope."
}
  1. 我的第二步是从创建的信封中实际获取 tabId 值,而不是使用制表符(在创建信封之前我不会有的东西)。

通过使用 JSON 中的 tabId 调用 /envelopeid/recipients/5/tabs 而不是像

{
    "textTabs":[
        {
            "tabId": "57135910-fe34-417d-a4e3-fc7d6c4a42ed",
            "value":"123"
        }
    ]
}

然后字段值得到正确更新。

总之,对于我的解决方法,需要对 DocuSign 进行三个调用才能为该收件人设置默认值:

  • 创建信封
  • 获取收件人标签(以获取标签 ID 的值)
  • 使用选项卡 ID 更新选项卡值。

【问题讨论】:

  • 您从中分配值的选项卡在哪里?在服务器模板“A3B4F6BB-639A-486F-8C84-826295142F21”中?
  • 是的,它们在模板中。我要做的是将模板分配给文档,然后为其中一位用户默认一些值。
  • @AndrewWilson Andrew,由于模板中的选项卡,我是否需要在不同的位置进行分配?
  • @AndrewWilson 只是想跟进,看看是否由于模板中的标签是否应该以不同的方式分配
  • 在下面查看我的答案。

标签: docusignapi


【解决方案1】:

您确定将收件人与您在模板上配置的有效角色正确匹配吗?

例如,我看到您为收件人 #5 分配了"AP2" 角色,当您登录网站并查看模板时,该角色是否存在于您的模板中?

【讨论】:

  • 收件人#5 的角色设置为 AP2,我将名称设置为 ap 作为占位符。 "名称":"ap", "recipientId":5, "roleName":"AP2",
  • 我已经添加了收件人的屏幕截图以及其中一个字段
  • 正如您在我的代码中看到的那样,我将标签分配给"AP2",名称为"ap",所以我看不到我遗漏了什么。
  • 您可能会想到 Ergin 的任何其他事情吗?
  • 没有什么明显的我能想到的,在这一点上,我将开始隔离你的代码的工作。如果您尝试将textTabs 分配给第一个收件人,会发生什么情况?在模板上为他们分配不同的roleName 怎么样?我还将测试发送一个只有一个收件人和分配给他们的标签的信封,看看会发生什么。最后,我总是对服务器模板属性下的sequence 参数和defaultRecipient 属性感到有些困惑。您可能还想围绕这些进行测试。
【解决方案2】:

很抱歉延迟了很长时间,您的 JSON 需要一个小 tweek。

您需要将sequenceserverTemplates 更改为1,将值分配给同一模板。

"serverTemplates":[
  {
    "sequence":"1",
  }

这将消除对 GET/PUT 的需要(尽管如果您愿意,您仍然可以执行 GET 来验证信息)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多