25024

Populate Dropdown options using c# code in a docusign template before creating envelope

Question:

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);

Answer1:

<blockquote>

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

</blockquote>

Documentation <a href="https://www.docusign.com/developer-center/explore/features/templates" rel="nofollow">here</a>

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);

Recommend

  • Send bash environment variable back to python fabric
  • Php form failing
  • Is it possible to have a Function that takes any number of variables of any type?
  • Docusign API Multiple Embedded in Person Signers
  • How to set an option to delete envelope in docusign
  • Docusign can't login. How to login in C# code?
  • Update cell values on Google sheet during mail merge apps script
  • Send email based on the sum of cells from a form submission in Google Sheets
  • How to hide the login window after DocuSign finish click
  • Why am I unable to create a trigger using my SqlCommand?
  • When using telnet or netcat to test an outgoing SMTP email I cannot end message 'with “.” on a
  • Any way of appending to the act method in scala?
  • onCloseDialog event not working in my Controller. What's wrong with my code?
  • Yii2 Login with database
  • Mocha throws unexpected token error for ES6 object spread operator
  • Action Pack components in Rails
  • Criterion causing memory consumption to explode, no CAFs in sight
  • Do I need to seed any random number generator before using EVP_PKEY_keygen of OpenSSL?
  • Button click event not firing in jQuery
  • Not able to aggregate on nested fields in elasticsearch
  • why xml file does not aligned properly after append the string in beginning and end of the file usin
  • Assign variable to the value in HTML
  • How do I access an unhandled exception in an MVC Error view?
  • WPF - CanExecute dosn't fire when raising Commands from a UserControl
  • How to attach a node.js readable stream to a Sendgrid email?
  • Email verification using google app script and google forms
  • PostgreSQL Query without WHERE only ORDER BY and LIMIT doesn't use index
  • Email format validation in mvc3 view
  • Validaiting emails with Net.Mail MailAddress
  • sending/ receiving email in Java
  • JSON with duplicate key names losing information when parsed
  • Which linear programming package should I use for high numbers of constraints and “warm starts” [clo
  • 'TypeError' while using NSGA2 to solve Multi-objective prob. from pyopt-sparse in OpenMDAO
  • Javascript + PHP Encryption with pidCrypt
  • Redux, normalised entities and lodash merge
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Linking SubReports Without LinkChild/LinkMaster
  • EntityFramework adding new object to nested object collection
  • How to Embed XSL into XML