在创建信封之前,使用c#代码在docusign模板中填充下拉菜单选项 [英] Populate Dropdown options using c# code in a docusign template before creating envelope

查看:122
本文介绍了在创建信封之前,使用c#代码在docusign模板中填充下拉菜单选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在管理帐户面板中创建了一个模板,并且正在使用该模板创建新的信封并发送给其他收件人。
但是在我的模板中,我有一个下拉列表,其值在某些情况下会发生变化,
像对于状态A而言将具有不同的值,对于状态B而言它将具有不同的值。
如何以编程方式处理它。
这是我如何从模板创建信封。

I have create a template in my Admin Account Panel, and I am using the template to create new envelopes and send to different receivers. But in my template I have a dropdown whose value changes on some condition, like for State A it will have different values, for State B it will have different values. How do I handle it programmatically. Here is how I create an envelope from a template.

        string recipientEmail = "a@a.com";
        string recipientName = "John Doe";
        string templateRoleName = "Customer";
        string TemplateId = "xxxxxxxx-c87454e95429";

        EnvelopeDefinition envDef = new EnvelopeDefinition();
        envDef.EmailSubject = "[DocuSign C# SDK] - Please sign this doc";

        // assign recipient to template role by setting name, email, and role name.  Note that the
        // template role name must match the placeholder role name saved in your account template.  
        TemplateRole tRole = new TemplateRole();
        tRole.Email = recipientEmail;
        tRole.Name = recipientName;
        tRole.RoleName = templateRoleName;

        List<TemplateRole> rolesList = new List<TemplateRole>() { tRole };

        // add the role to the envelope and assign valid templateId from your account
        envDef.TemplateRoles = rolesList;
        envDef.TemplateId = TemplateId;

        // set envelope status to "sent" to immediately send the signature request
        envDef.Status = "sent";

        // |EnvelopesApi| contains methods related to creating and sending Envelopes (aka signature requests)
        EnvelopesApi envelopesApi = new EnvelopesApi(cfi);
       EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(accountID, envDef);


推荐答案


在以下位置填充选项卡模板,您必须使用 tabLabel 属性匹配选项卡的名称,并将其值设置为要使用

To populate tabs in a template you must match the name of the tab using the tabLabel property and set its value to the data you want to populate it with


填充的数据

文档此处

string recipientEmail = "a@a.com";
 string recipientName = "John Doe";
 string templateRoleName = "Customer";
 string TemplateId = "xxxxxxxx-c87454e95429";

 EnvelopeDefinition envDef = new EnvelopeDefinition();
 envDef.EmailSubject = "[DocuSign C# SDK] - Please sign this doc";

// assign recipient to template role by setting name, email, and role name.  Note that the
// template role name must match the placeholder role name saved in your account template.  
var tRole = new TemplateRole();
tRole.Email = recipientEmail;
tRole.Name = recipientName;
tRole.RoleName = templateRoleName;

var dropdownItems = new List<ListItem>();

if (stateA)
{
    dropdownItems.Add(new ListItem()
    {
        Text = "Yellow", Value = "Y", Selected = "true"
    });
    dropdownItems.Add(new ListItem()
    {
        Text = "Green",Value = "G"
    });
}
else
{
    dropdownItems.Add(new ListItem()
    {
        Text = "Red", Value = "R", Selected = "true"
    });
    dropdownItems.Add(new ListItem()
    {
        Text = "Blue", Value = "B"
    });
    dropdownItems.Add(new ListItem()
    {
        Text = "Orange", Value = "O"
    });
}

tRole.Tabs = new Tabs()
{
    ListTabs = new List<List>()
    {
        new List(){
            TabLabel = "ColorDropdown",
            ListItems = dropdownItems
        }
    }
};

var rolesList = new List<TemplateRole>() { tRole };

// add the role to the envelope and assign valid templateId from your account
envDef.TemplateRoles = rolesList;
envDef.TemplateId = TemplateId;

// set envelope status to "sent" to immediately send the signature request
envDef.Status = "sent";

// |EnvelopesApi| contains methods related to creating and sending Envelopes (aka signature requests)
EnvelopesApi envelopesApi = new EnvelopesApi();
EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(accountID, envDef);

这篇关于在创建信封之前,使用c#代码在docusign模板中填充下拉菜单选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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