Reputation: 813
Is it possible to dynamically add a text value to an existing docusign template ?
I have an existing template that I retrieve from docusign, but I want to customize certain fields based on who I am sending it to.
I have seen text Tabs being used, but in my case it is not succesfull and I am not sure if that only works, when creating the template within the code itself.
EnvelopeDefinition envDef = new EnvelopeDefinition();
envDef.EmailSubject = "[DocuSign C# SDK] - Please sign this doc";
TemplateRole tRole = new TemplateRole();
tRole.Email = "[email protected]";
tRole.Name = "testing";
tRole.RoleName = "{ROLE}";
List<Text> tabsTextList = new List<Text>();
tRole.Tabs = new Tabs();
tRole.Tabs.TextTabs = new List<Text>();
Text textTab = new Text();
textTab.TabLabel = "Someones Address";
textTab.Value = userName.Address;
textTab.XPosition = "100";
textTab.YPosition = "100";
tRole.Tabs.TextTabs.Add(textTab);
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 = "***679-987***";
Upvotes: 0
Views: 591
Reputation: 813
Thanks to Inbar Gazit, I realized that my role name was not matching what I set from the server side.
tRole.Name = "testing";
tRole.RoleName = "{ROLE}"
and the lable had to match as well.
textTab.TabLabel = "Someones Address";
Fairly straight forward, just an over site. Hopefully this helps someone.
Upvotes: 1
Reputation: 14015
Best approach to do this is to use Composite Templates. With composite templates, you can mix and match and customize your templates via the API in any way you choose. This blog post would be a good place to start:
https://www.docusign.com/blog/dsdev-from-the-trenches-composite-templates/ and it has C# code to do something similar, but you can modify it for your needs.
Upvotes: 1