当前位置: 首页 > 知识库问答 >
问题:

在基于模板的docusign信封上添加签名者

程卓君
2023-03-14

我已经创建了一个模板,并添加了两个角色signer1和Signer2。我正在创建信封,并使用这个模板在飞行中添加签名者。它工作得很好。在某些情况下,管理员用户不知道第二个签名者,只添加第一个签名者,信封是用单个签名者创建的。一旦信封被创建,现在我想在信封上添加第二个签名者。我使用C#docusign客户端,我尝试了

  {                 
     var templateInfo = await envelopesApi.ListTemplatesAsync(await AccountAsync(), envelopeId, new EnvelopesApi.ListTemplatesOptions { include = "applied" }); //fetching template id
                foreach (var template in templateInfo.Templates)
                {
                    var templateRecipients = await templatesApi.ListRecipientsAsync(await AccountAsync(), template.TemplateId, new ListRecipientsOptions { includeTabs = "true" }); //fetching tabs assigned to roles in templatea
                Var signer=  templateRecipients.Signers.FirstOrDefault(w => w.RoleName.ToLower() == signer.SigningRole.ToLower())
                    Recipients.Signers = signers.Aggregate(new List<Signer>(), (newSigners, signer) =>
                    {
                        string recipeintId = Guid.NewGuid().ToString();
                        Tabs tabs = templateSigner.Tabs;
                        Tabs newTabs = new Tabs();
                        var newSigner = new Signer
                        {
                            Email = signer.Email,
                            Name = signer.FullName,
                            RoleName = signer.SigningRole,
                            //ClientUserId = signer.Email,
                            RecipientId = recipeintId, //Int or Guid expected
                            Tabs =BuildRecipientTabs(recipeintId,signer?.Tabs) ; //copying tabs
                        };
                        newSigners.Add(newSigner);
                        return newSigners;
                    });


    var something = await envelopesApi.UpdateRecipientsAsync( AccountId, envelopeId, recipients);
}
//
         private Tabs BuildRecipientTabs(string recipientId, Tabs tabs)
        {
            Tabs newTab = new Tabs();
            if (tabs.ApproveTabs != null)
            {
                tabs.ApproveTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.CheckboxTabs != null)
            {
                tabs.CheckboxTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.DateTabs != null)
            {
                tabs.DateTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.DateSignedTabs != null)
            {
                tabs.DateSignedTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.DeclineTabs != null)
            {
                tabs.DeclineTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.EmailAddressTabs != null)
            {
                tabs.EmailAddressTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.EmailTabs != null)
            {
                tabs.EmailTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.EnvelopeIdTabs != null)
            {
                tabs.EnvelopeIdTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.FullNameTabs != null)
            {
                tabs.FullNameTabs.ForEach(w => { if (w!=null) { w.RecipientId = recipientId;}});             
            }
            if (tabs.FirstNameTabs != null)
            {
                tabs.FirstNameTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.FormulaTabs != null)
            {
                tabs.FormulaTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.InitialHereTabs != null)
            {
                tabs.InitialHereTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }           
            if (tabs.LastNameTabs != null)
            {
                tabs.LastNameTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.ListTabs != null)
            {
                tabs.ListTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.NotarizeTabs != null)
            {
                tabs.NotarizeTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.NoteTabs != null)
            {
                tabs.NoteTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.NumberTabs != null)
            {
                tabs.NumberTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.PolyLineOverlayTabs != null)
            {
                tabs.PolyLineOverlayTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }           
            if (tabs.RadioGroupTabs != null)
            {
                tabs.RadioGroupTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.SignerAttachmentTabs != null)
            {
                tabs.SignerAttachmentTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.SignHereTabs != null)
            {
                tabs.SignHereTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; w.TabId = null; } });
            }
            if (tabs.SmartSectionTabs != null)
            {
                tabs.SmartSectionTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.SsnTabs != null)
            {
                tabs.SsnTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.TitleTabs != null)
            {
                tabs.TitleTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.TextTabs != null)
            {
                tabs.TextTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId;  w.TabId=null; } });

            }
            if (tabs.TabGroups != null)
            {
                tabs.TabGroups.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }          
            if (tabs.ViewTabs != null)
            {
                tabs.ViewTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            if (tabs.ZipTabs != null)
            {
                tabs.ZipTabs.ForEach(w => { if (w != null) { w.RecipientId = recipientId; } });
            }
            return tabs;
        }

共有1个答案

诸葛砚文
2023-03-14

我刚刚找到了这个需求的解决方案。标签不使用UpdateRecipientsAsync或CreateRecipientsAsync创建或更新

它使用CreateTabasync工作。

 //build recipients
                recipients.Signers = signers.Aggregate(new List<Signer>(), (newSigners, signer) =>
                {
                    string recipeintId = Guid.NewGuid().ToString();
                    var newSigner = new Signer
                    {
                        Email = signer.Email,
                        Name = signer.FullName,
                        RoleName = signer.SigningRole,
                        ClientUserId = signer.Email,
                        RecipientId = recipeintId //Int or Guid expected                      
                    };
                    newSigners.Add(newSigner);
                    return newSigners;
                });
                var addedRecipient = await envelopesApi.CreateRecipientAsync(await AccountAsync(), envelopeId, recipients); //adding recipients
                var templateInfo = await envelopesApi.ListTemplatesAsync(await AccountAsync(), envelopeId, new EnvelopesApi.ListTemplatesOptions { include = "applied" });

                //envelope is created using one template only
                    var templateRecipients = await templatesApi.ListRecipientsAsync(await AccountAsync(), templateInfo.Templates.FirstOrDefault().TemplateId, new ListRecipientsOptions { includeTabs = "true" });
                    foreach (var signer in recipients.Signers)
                    {
                        Signer templateSigner = templateRecipients.Signers.FirstOrDefault(w => w.RoleName.ToLower() == signer.RoleName.ToLower());
                        Tabs tabs =BuildRecipientTabs(signer.RecipientId, templateSigner.Tabs);
                        var t=  await envelopesApi.CreateTabsAsync(await AccountAsync(), envelopeId, signer.RecipientId, tabs);
                    }


 类似资料:
  • 我创建了一个包含多个文档的docusign模板。模板声明了3个签名角色。然后,我从该模板创建一个有3个收件人信封。模板和我们的帐户启用了文档可见性,这样签名者只能查看他们必须签名的文档。在信封由所有三个签名完成后,我需要将每个完成的信封的PDF存储在我们站点上不同的收件人帐户下。由于启用了文档可见性,因此不能为所有3个签名者提供一个PDF。这将打破可见性功能,他们将能够看到彼此的私人信息。相反,必

  • 我有在DocuSign中创建的信封和签名者列表。我忘记在创建信封时添加唯一的ClientUserId。在应用程序中进行嵌入式签名需要Unique ClientUserId。 如何将ClientUserId添加到现有DocuSign信封的签名者?

  • 当我添加新的接受者并用下面的代码在模板中发送文档时

  • 我们使用DocuSign SDK(版本3.3.0),并利用webhooks来接收各种信封和收件人事件。 虽然作为发件人使用DocuSign API删除信封相当容易,但作为收件人使用DocuSign API删除信封的方法却不多。

  • 我正在使用DocuSign REST API创建一个信封以及签名者。查看API,您可以提供签名者的姓名和电子邮件,因此当签名者接收到要签名的文档并进入DocuSign签名文档时,已经用签名者块中提供的姓名填写了“名称”“占位符”。是否有任何方法来添加关于签名者的其他“占位符”值,如“title”,这样当他们去签名时,这些“占位符”已经填满了(用户可以更新值,如果他们选择)? https://dev

  • 我使用信封API得到以下响应 我无法打开信封,即使我已登录到Web中的站点。让我知道打开信封的URL。响应没有给出确切的URL。