使用复合模板创建 DocuSign 信封时避免多次重复收件人信息

Avoid repeating recipient information multiple times while creating DocuSign envelope with composite template

我正在使用复合模板,因为我需要在信封中包含多个模板。在所有模板中,签名角色都是相同的。我有以下角色和签名顺序。

我还需要在创建信封时为每个角色提供自定义电子邮件主题和正文。

这是我的请求 json 使用复合模板创建信封。故意将第二个复合模板部分留空,以免太大。

{
    "status": "created",
    "compositeTemplates": [
        {
            "serverTemplates": [
                {
                    "sequence": "1",
                    "templateId": "de231abb-4566-4433-8c10-6fae41d5f36e"
                }
            ],
            "inlineTemplates": [
                {
                    "envelope": {
                        "customFields": {
                            "textCustomFields": [
                                {
                                    "name": "policy",
                                    "value": "12345"
                                }
                            ]
                        }
                    },
                    "sequence": "1",
                    "recipients": {
                        "carbonCopies": [
                            {
                                "recipientId": "1",
                                "email": "email2@domain.com",
                                "name": "Supervisor Name",
                                "roleName": "Supervisor",
                                "routingOrder": "2",
                                "emailNotification": {
                                    "supportedLanguage": "en",
                                    "emailSubject": "Custom email subject for supervisor",
                                    "emailBody": "Custom email body for supervisor"
                                }
                            },
                            {
                                "recipientId": "2",
                                "email": "email1@domain.com",
                                "name": "Admin Name",
                                "roleName": "Admin",
                                "routingOrder": "4",
                                "emailNotification": {
                                    "supportedLanguage": "en",
                                    "emailSubject": "Custom email subject for admin",
                                    "emailBody": "Custom email body for admin"
                                }
                            }
                        ],
                        "signers": [
                            {
                                "recipientId": "3",
                                "email": "email3@domain.com",
                                "name": "Data entry person Name",
                                "roleName": "DataEntry",
                                "routingOrder": "1",
                                "emailNotification": {
                                    "supportedLanguage": "en",
                                    "emailSubject": "Custom email subject for data entry person",
                                    "emailBody": "Custom email body for data entry person"
                                },
                                "tabs": {
                                    "textTabs": [
                                        {
                                            "tabLabel": "field name",
                                            "value": "field value"
                                        }
                                    ]
                                }
                            },
                            {
                                "recipientId": "4",
                                "email": "email4@domain.com",
                                "name": "client Name",
                                "roleName": "Client",
                                "routingOrder": "3",
                                "emailNotification": {
                                    "supportedLanguage": "en",
                                    "emailSubject": "Custom email subject for the client",
                                    "emailBody": "Custom email body for the client"
                                },
                                "tabs": {
                                    "textTabs": [
                                        {
                                            "tabLabel": "other field name",
                                            "value": "other value"
                                        },
                                        {
                                            "tabLabel": "other2 field name",
                                            "value": "other2 value"
                                        }
                                    ]
                                }
                            }
                        ]
                    }
                }
            ]
        },
        {
            "serverTemplates": [
                {
                    "sequence": "1",
                    "templateId": "de231abb-4566-4433-8c10-6fae41d5f36e"
                }
            ],
            "inlineTemplates": [
                {
                    .
                    - repeat same recipient information again
                    .
                }
            ]
        }
    ]
}

当我准备信封创建请求 json 时,我必须为我需要包含的每个模板创建一个 CompositeTemplate。在 compositeTemplates[x]/inlineTemplates[0]/recipients 中,我为所有 4 个收件人指定了信息(姓名、电子邮件、角色名称、routingOrder、电子邮件主题、电子邮件正文和选项卡(如果适用))。我必须在 CompositeTemplate 中重复相同的 compositeTemplates[x]/inlineTemplates[0]/recipients,其中包含重复信息(姓名、电子邮件、角色名称、routingOrder、电子邮件主题、电子邮件正文),这对我来说听起来不对。

问题#1 -你知道是否有任何方法可以在一个地方提供收件人而不是在每个 CompositeTemplate 下复制它?

我的下一个问题是关于证明收件人和标签信息,但从不同的角度。在 inlineTemplates 下的 Composite 模板中,我必须使用 EnvelopDefinition 下的 EnvelopeRecipients to specify recipient and it’s tabs. In this case I need to know signing authority of each recipient/role because I need to put them under signers, corbonCopy etc. In case of envelope with single template I can easily use templateRole 来按角色指定收件人及其标签信息。我不需要知道角色的签名权限。

问题#2 –有没有办法在 CompositeTemplate 中按角色指定收件人信息,而无需像使用单个模板信封那样知道签名权限?

回答#1

我不这么认为。如果此工作流程很常见,您可以考虑创建第三个模板,其中包含前两个模板的文档和选项卡。

然后,您只需发送一个仅包含第三个模板的信封即可。在这种情况下,您只需指定一次收件人的信息。

但是,我们通常建议使用复合模板模式,因为当您的用例将来发生变化时,自定义和扩展会容易得多。

回答#2

没有。您正在混合使用两种不同的 DocuSign 设计模式,即您不应混合使用 Composite Template 和 TemplateRole。

当您有一个服务器模板并且想要预填充签名者信息时,需要模板角色 and/or 您的应用程序模板中存在的任何 DocuSign 选项卡信息。

您可以做的(我相信您已经意识到)是在使 POST /envelopes 包含复合模板之前使用 GET /template 检索模板的签名权限。