docusignapi - 文档签名 : create envelope with recipient custom field

标签 docusignapi docusigncompositetmplts

我正在尝试基于模板创建一个信封,并将自定义字段分配给其中一个收件人("customFields": ["5616999"] ,这是员工 ID)。

这是我的 POST REST API: URI:https://demo.docusign.net/restapi/v2/accounts/{accountid}/envelopes

有效负载:

 { "status":"sent",
"emailSubject": "Test with template and custom field",
"templateId": "447e6671-74d1-45ce-bf3b-aa7a5c235ea5", "documents": [{ "documentId": "25407849", "name": "testTemplateDoc2.pdf", "documentBase64": " my base64 string of the document"}], 
"templateRoles": [{
        "email": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="077362747347606a666e6b2964686a" rel="noreferrer noopener nofollow">[email protected]</a>",
        "name": "john doe",
        "recipientId": "10501840",
        "roleName": "RH",
        "routingOrder": "1",
        "emailNotification": {
            "emailBody": "text12808",
            "emailSubject": "Signez ce document [[Collaborateur_UserName]]",
            "supportedLanguage": "fr"
        },
        "recipientSignatureProviders": [{
                "signatureProviderName": "universalsignaturepen_opentrust_hash_tsp",
                "signatureProviderOptions": {
                    "sms": "+33265555555"
                }
            }
        ],
        "tabs": {
            "signHereTabs": [{
                    "anchorString": "/RH1/",
                    "anchorUnits": "pixels",
                    "anchorXOffset": "0",
                    "anchorYOffset": "0",
                    "name": "Please sign here",
                    "optional": "false",
                    "recipientId": "10501840",
                    "scaleValue": 1
                }
            ]
        }
    }, {
        "email": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="71051402054331161c10181d5f121e1c" rel="noreferrer noopener nofollow">[email protected]</a>",
        "name": "jane doe",
        "recipientId": "61432066",
        "roleName": "Collaborateur",
        "routingOrder": "2",
        "emailNotification": {
            "emailBody": "text2 2808",
            "emailSubject": "Signez votre document Mr. [[Collaborateur_UserName]]",
            "supportedLanguage": "fr"
        },
        "recipientSignatureProviders": [{
                "signatureProviderName": "universalsignaturepen_opentrust_hash_tsp",
                "signatureProviderOptions": {
                    "oneTimePassword": "1234"
                }
            }
        ],
        "tabs": {
            "signHereTabs": [{
                    "anchorString": "/S1/",
                    "anchorUnits": "pixels",
                    "anchorXOffset": "0",
                    "anchorYOffset": "0",
                    "name": "Please sign here",
                    "optional": "false",
                    "recipientId": "61432066",
                    "scaleValue": 1
                }
            ]
        },
        "customFields": ["5616999"]
    }, {
        "email": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="71051402054231161c10181d5f121e1c" rel="noreferrer noopener nofollow">[email protected]</a>",
        "name": "john3 doe3",
        "recipientId": "64377607",
        "roleName": "Directeur",
        "routingOrder": "3",
        "emailNotification": {
            "emailBody": "text3 2808",
            "emailSubject": "consultez le document de Mr. [[Collaborateur_UserName]]",
            "supportedLanguage": "fr"
        },
        "recipientSignatureProviders": [{
                "signatureProviderName": "universalsignaturepen_opentrust_hash_tsp",
                "signatureProviderOptions": {
                    "oneTimePassword": "1234"
                }
            }
        ]
    }
]
}

所以我收到了 200 OK 并且我的信封已成功创建,但是当我对信封执行简单的 GET 操作时,收件人自定义字段不会出现。 我认为没有考虑到这一点。 这是我的 GET URI

https://demo.docusign.net/restapi/v2/accounts/{accountID}/envelopes/{envelopeid}/recipients?include_extended=true&include_tabs=true

这是结果:

{
    "signers": [
        {
            "tabs": {
                "signHereTabs": [
                    {
                        "stampType": "signature",
                        "name": "Please sign here",
                        "tabLabel": "Sign Here",
                        "scaleValue": 1,
                        "optional": "false",
                        "documentId": "1",
                        "recipientId": "1",
                        "pageNumber": "1",
                        "xPosition": "69",
                        "yPosition": "688",
                        "anchorString": "/RH1/",
                        "anchorXOffset": "0",
                        "anchorYOffset": "0",
                        "anchorUnits": "pixels",
                        "tabId": "a3c9e24a-054c-4e39-bb85-ff602c9afd15"
                    }
                ]
            },
            "signInEachLocation": "false",
            "creationReason": "sender",
            "isBulkRecipient": "false",
            "recipientSignatureProviders": [
                {
                    "signatureProviderName": "universalsignaturepen_opentrust_hash_tsp",
                    "signatureProviderOptions": {
                        "sms": "+330642037079"
                    }
                }
            ],  
            "name": "john doe",
            "email": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ff8b9a8c8bbf98929e9693d19c9092" rel="noreferrer noopener nofollow">[email protected]</a>",
            "recipientId": "1",
            "recipientIdGuid": "77e97f08-552e-4e5b-ab0d-1802d72813cf",
            "requireIdLookup": "false",
            "userId": "0358b4e5-2c64-4d37-a6c2-d9f099ff5071",
            "routingOrder": "1",
            "note": "",
            "roleName": "RH",
            "status": "created",
            "deliveryMethod": "email",
            "templateLocked": "false",
            "templateRequired": "false",
            "emailNotification": {
                "emailSubject": "[BPMED] Signez ce document [[Collaborateur_UserName]]",
                "emailBody": "text12808",
                "supportedLanguage": "fr"
            },
            "totalTabCount": "1"
        },
        {
            "tabs": {
                "signHereTabs": [
                    {
                        "stampType": "signature",
                        "name": "Please sign here",
                        "tabLabel": "Sign Here",
                        "scaleValue": 1,
                        "optional": "false",
                        "documentId": "1",
                        "recipientId": "2",
                        "pageNumber": "1",
                        "xPosition": "69",
                        "yPosition": "264",
                        "anchorString": "/S1/",
                        "anchorXOffset": "0",
                        "anchorYOffset": "0",
                        "anchorUnits": "pixels",
                        "tabId": "5bf64798-f22a-4f08-9bfd-da5745c1c0a0"
                    }
                ]
            },
            "signInEachLocation": "false",
            "creationReason": "sender",
            "isBulkRecipient": "false",
            "recipientSignatureProviders": [
                {
                    "signatureProviderName": "universalsignaturepen_opentrust_hash_tsp",
                    "signatureProviderOptions": {
                        "oneTimePassword": "1234"
                    }
                }
            ],

            "name": "jane doe",
            "email": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="285c4d5b5c1a684f45494144064b4745" rel="noreferrer noopener nofollow">[email protected]</a>",
            "recipientId": "2",
            "recipientIdGuid": "c3de6e46-be6a-4ccf-b939-30c0cd251849",
            "requireIdLookup": "false",
            "userId": "e0a726f8-a89d-4b86-99fc-153150cd4892",
            "routingOrder": "2",
            "note": "",
            "roleName": "Collaborateur",
            "status": "created",
            "deliveryMethod": "email",
            "templateLocked": "false",
            "templateRequired": "false",
            "emailNotification": {
                "emailSubject": "[BPMED] Signez votre document Mr. [[Collaborateur_UserName]]",
                "emailBody": "text2 2808",
                "supportedLanguage": "fr"
            },
            "totalTabCount": "2"
        }
    ],
    "agents": [],
    "editors": [],
    "intermediaries": [],
    "carbonCopies": [],
    "certifiedDeliveries": [
        {

            "name": "john3 doe3",
            "email": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9de9f8eee9aeddfaf0fcf4f1b3fef2f0" rel="noreferrer noopener nofollow">[email protected]</a>",
            "recipientId": "3",
            "recipientIdGuid": "b9569f7c-996d-4549-88f6-1e05e9b96ea7",
            "requireIdLookup": "false",
            "userId": "6f0b5463-3baa-4607-bcc9-1958873c12e2",
            "routingOrder": "3",
            "note": "",
            "roleName": "Directeur",
            "status": "created",
            "templateLocked": "false",
            "templateRequired": "false",
            "emailNotification": {
                "emailSubject": " consultez le document de Mr. [[Collaborateur_UserName]]",
                "emailBody": " text3 2808",
                "supportedLanguage": "fr"
            },
            "totalTabCount": "0"
        }
    ],
    "inPersonSigners": [],
    "recipientCount": "3"
}

我尝试在草稿模式下创建信封,然后发出 PUT 请求来添加自定义字段,但它也不起作用...

PS:我已经成功创建了带有收件人自定义字段(不基于模板)的信封,一切正常,并且收件人自定义字段已很好地集成在信封中。

最佳答案

您可以使用 DocuSign compositeTemplates并指定收件人自定义字段。这是一个例子。 templateRoles不支持指定收件人自定义字段

{
    "emailSubject": "Test with template and custom field",
    "status": "sent",
    "compositeTemplates": [
        {
            "serverTemplates": [
                {
                    "sequence": "1",
                    "templateId": "447e6671-74d1-45ce-bf3b-aa7a5c235ea5"
                }
            ],
            "inlineTemplates": [
                {
                    "sequence": "1",
                    "recipients": {
                        "signers": [
                            {
                                "email": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f88c9d8b8cb89f95999194d69b9795" rel="noreferrer noopener nofollow">[email protected]</a>",
                                "name": "john doe",
                                "recipientId": "10501840",
                                "roleName": "RH",
                                "routingOrder": "1",
                                "customFields": [ "5616999" ],
                                "tabs": { },
                                "emailNotification": { },
                                "recipientSignatureProviders": { }

                            }
                        ]
                    }
                }
            ],
            "document": {
                "documentId": "25407849",
                "name": "testTemplateDoc2.pdf",
                "fileExtension": "pdf",
                "documentBase64": ""
            }
        }
    ]
}

关于docusignapi - 文档签名 : create envelope with recipient custom field,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45919381/

相关文章:

docusignapi - 重新发送DocuSign电子邮件

c# - 使用 C# 重新发送 Docusign 信封

docusignapi - 即使在提供同意后生成 JWT 访问 token 时出现 "consent_required"错误

certificate - 电子签名公司如何创建有效的数字签名

node.js - Docusign 沙箱 |总是返回 invalid_grant 错误 |授权代码授予

docusignapi - DocuSign 复合模板的 <PDFBytes> 中包含哪些类型的数据?

docusignapi - Docusign - 在此处签名选项卡出现多次

java - DocuSign 启用打印和登录 其他操作