DocuSign Rest API替换单个模板文档 [英] DocuSign Rest API to replace single template document

查看:99
本文介绍了DocuSign Rest API替换单个模板文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何用复合模板替换文档。该模板具有三个文档,并定义了签名者信息。即使我尝试仅替换第一个文档(其字段如下定义),该文档也无法正常工作。如果inlineTemplates的序列号为1,而serverTemplates的序列号为2,则将按预期替换第一个文档,但其余两个文档均已消失。如果每个序列号都改为相反,则模板中定义的三个文档将保留在信封中,并且新文档不会替换为第一个文档。

I would like to know how to replace a document with composite templates. The template has three documents and defines signer info. Even though I tried to replace only 1st document that fields (tags) are defined as below it doesn’t work well. If sequence number of inlineTemplates is 1 and its number of serverTemplates is 2, 1st document is replaced as expected but the remaining two documents are gone. If each sequence number changes to opposite, three documents defined in the template are remained in envelope and new document is not replaced to 1st document.

只要我要查找信息跨stackoverview和其他站点,我还没有找到任何解决方案。

As long as I look for info across stackoverview and other sites I didn’t find any solution yet.

    {
    "compositeTemplates" : [
    {
                "serverTemplates": [
                    {
                        "sequence": "2",
                        "templateId": "cba8d3ae-3f0e-4329-9c7a-9da0e612f153"
                    }
                ],

                "inlineTemplates": [
                    {
                        "sequence": "1",
                        "documents": [  
                            {
                                "documentId": "1",
                                "name": "1Update.pdf",
                                "fileExtension" : "pdf",
                                "transformPdfFields" : "false",
                                "documentBase64":"<base64 content>

                            }
                            ],
                    }
                    ],


        }
        ],

        "status": "created"

}


推荐答案

如果服务器模板包含三个文档,并且您想在创建信封时用另一个文档替换第一个文档,则DocuSign将无法执行此操作,因此DocuSign将期望您打算替换所有文档,它将引发错误,并要求您在联机模板中发送其他文档。

If you server template has three documents and you want to replace first document with another one at the time creating an envelope then DocuSign will not be able to do as then DocuSign will expect that you are planning to replace all documents and it will throw an error and ask you to send other documents as well in the Inline Template.

因此,此方案的解决方案是,您需要制作多个服务器模板,至少在您的情况下,需要两个服务器模板,一个服务器模板应包含您想要的文档。 replace和另一个服务器模板,该模板将是静态的,并且将直接放在信封中。完成后,您的复合模板将是两个复合模板的数组。 First Composite模板将具有First Server Template,并且可以使用InlineTemplate或按文档节点替换服务器模板文档。第二个复合模板将仅包含来自第二个服务器模板的文档,该解决方案的代码可能如下所示:

So solution for this scenario will be, you need to make multiple server template, at least in your case two server templates, one server template should have document which you want to replace and another server template which will be static and it will go as-is in the envelope. Once that is done then your composite templates will be an array of two composite template. First Composite template will have First Server Template and using InlineTemplate or by document node you can replace the server template document. And second composite template will have only documents coming from 2nd server templates, with the solution your code might look like below:

在下面的代码中,服务器模板中的文档d7697d56-e7ff -4a86-9b21-e98b81bd66c2已被替换为内联模板,或者您也可以在文档节点中传递它,并且f30d22b7-17da-4b61-af00-5f418f7916ec是不需要替换文档的服务器模板,它将直接来自服务器模板。

In below code, document in server template d7697d56-e7ff-4a86-9b21-e98b81bd66c2 is getting replaced by Inline Template or you can pass it in document node also, and f30d22b7-17da-4b61-af00-5f418f7916ec is the server template where no documents need to be replaced, it will come as is from the server template.

{
   "compositeTemplates": [
      {
         "compositeTemplateId":"1",
         "inlineTemplates": [
            {  
               "documents":[
                        {
                          "documentBase64": "<PDFBytes>",
                          "documentId": "1",
                          "fileExtension": "pdf",
                          "name": "Runtime Agreement"
                 }
               ],
               "recipients": {
                  "signers": [
                     {
                        "email": "email@gmail.com",
                        "name": "John Doe",
                        "recipientId": "1",
                        "roleName": "Signer1",
                        "routingOrder": "1"
                     }
                  ]
               },
               "sequence": "1"
            }
         ],
         "serverTemplates": [
            {
               "sequence": "2",
               "templateId": "d7697d56-e7ff-4a86-9b21-e98b81bd66c2"
            }
         ]
      },
      {
         "compositeTemplateId":"2",
         "inlineTemplates": [
            {  
               "recipients": {
                  "signers": [
                     {
                        "email": "email@gmail.com",
                        "name": "John Doe",
                        "recipientId": "1",
                        "roleName": "Signer1",
                        "routingOrder": "1"
                     }
                  ]
               },
               "sequence": "2"
            }
         ],
         "serverTemplates": [
            {
               "sequence": "1",
               "templateId": "f30d22b7-17da-4b61-af00-5f418f7916ec"
            }
         ]
      }
   ],
   "status": "sent"
}

这篇关于DocuSign Rest API替换单个模板文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆