文档签名为每个收件人预填充选项卡值



当我有多个具有不同值的收件人时,使用 SOAP API 有什么方法可以在信封中预填充标签。一个例子是;我在模板中有 2 个收件人(或可能更多)和一个标签/选项卡(文本)。我希望此标签预先填充收件人的姓名,以便当他们获得它时,收件人 1 将在文档标签上看到他/她的名字,收件人 2 将看到他/她的名字。

尝试获取模板选项卡并根据已经存在的模板值(主要是定位和类型等)创建新选项卡,我只是更改了值和收件人 ID 并将这些选项卡添加到列表中。但是,每当我更改选项卡的值/收件人 ID 时,列表中的其他值/收件人 ID 都会更改。我通过将列表转换为数组并将信封选项卡设置为新的选项卡数组来完成该过程。

这是过程:

    newEnvelope.Tabs = GetTabs(newEnvelope);
    private Tab[] GetTabs(Envelope envelope) {
     Tab[] exsitingTabs = envelope.Tabs;
     List<Tab> newTabs = new List<Tab>();
     foreach(Recipient r in envelope.Recipients) {
        Tab tab = exsitingTabs .ElementAt(14); // Just a custom text tag
        tab.RecipientID = r.ID;
        tab.Value = r.UserName;
        newTabs.Add(tab); //The older tab info gets replaced by the new tab info.
                          // all are still there, the old ones just have the same info
                          // as the latest added one
     }
     return newTabs.ToArray();
  }

是的,您绝对可以通过 DocuSign 为多个收件人预填充选项卡。 尝试为收件人设置不同的TabLabel,这可能会解决重复问题。 我认为这可能是问题的原因是因为当 TabLabel 相同时,字段将使用相同的值更新,但如果它们不同,则不会。

来自 DocuSign SOAP API 指南:

"Making custom tab’s TabLabel the same will cause the all like fields to update when the user enters data."

所以在你的 for 循环中,试试这个:

foreach(Recipient r in envelope.Recipients) {
    Tab tab = newTabs.ElementAt(14); // Just a custom text tag
    tab.RecipientID = r.ID;
    tab.Value = r.UserName;
    tab.TabLabel = r.ID; // or some other unique value for each recipient
    newTabs.Add(tab); //The older tab info gets replaced by the new tab info.
                      // all are still there, the old ones just have the same info
                      // as the latest added one

 }

我认为您可能遇到的问题是DocuSign选项卡是按收件人的,也就是说,它们被分配给信封中的特定收件人(或收件人角色)。

例如,如果您要发送贷款申请,并且有"签名者 1"和"签名者 2",则需要有一个"签名者

1Name"字段来捕获签名者 1 的姓名,以及签名者 2 的"签名者 2Name"(尽管,全名字段在收件人签名时由 DocuSign 自动填充)。您不会有一个"名称"选项卡,然后尝试用两个不同的值填充它(这就是您的代码似乎正在执行的操作)。

您的代码可能类似于@Ergin上面写的内容:

List<Tab> tabList = new List<Tab>();
Recipient[] recipients = newEnvelope.Recipients;
foreach (Recipient r in recipients)
{
    Tab tab = new Tab();
    tab.RecipientID = r.ID;
    tab.TabLabel = string.Format("Recipient{0}Name", r.ID);
    tab.Value = r.UserName;
    tab.DocumentID = "1";
    tabList.Add(tab);
}
newEnvelope.Tabs = tabList.ToArray();

要获取收件人 #1 的名称,您的选项卡标签将是"收件人 1Name"。

最新更新