Pre-filling Tabs on a Template in DocuSign

Viewed 369

I am using the C# JWT-framework.sln that was linked off of the DocuSign Development page.

I have the API working in the demo environment and I can do the following items:

  1. Send an Envelope with positional control of where the Signature block goes.
  2. Send an Envelope and dynamically add Tabs and position and set values for those Tabs.
  3. Retrieve Envelopes that are already signed off.
  4. Send an Envelope using a pre-defined Template.

The following code generates an envelope using my template...but I cannot the life of me, figure out how to get a list of tab objects that exist in the template, so that I can pre-populate them with data prior to routing the envelope for signatures.

EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition
        {
            EmailSubject = "Please sign this test document"
        };

        envelopeDefinition.TemplateId = "5a56ee22-91dd-443e-85f4-bd43b446db5b";

I am thinking I need to work with the TemplateTabs class, but I have not been able to find any examples of how to loop through all of the tabs on a template and then update specific tabs based on the Tab ID.

Any help would be appreciated.

Thanks jlimited

1 Answers

We have a code example showing you how to do this.

(of course, your template is different, just to give you an idea)

The C# relevant snippet is here:

 // Set the values for the fields in the template
        // List item
        List colorPicker = new List
        {
            Value = "green",
            DocumentId = "1",
            PageNumber = "1",
            TabLabel = "list"
        };

        // Checkboxes
        Checkbox ckAuthorization = new Checkbox
        {
            TabLabel = "ckAuthorization",
            Selected = "true"
        };
         Checkbox ckAgreement = new Checkbox
        {
            TabLabel = "ckAgreement",
            Selected = "true"
        };

        RadioGroup radioGroup = new RadioGroup
        {
            GroupName = "radio1",
            // You only need to provide the readio entry for the entry you're selecting
            Radios = new List<Radio> { new Radio { Value = "white", Selected = "true" } }
        };

        Text includedOnTemplate = new Text
        {
            TabLabel = "text",
            Value = "Jabberywocky!"
        };

        // We can also add a new tab (field) to the ones already in the template
        Text addedField = new Text
        {
            DocumentId = "1",
            PageNumber = "1",
            XPosition = "280",
            YPosition = "172",
            Font = "helvetica",
            FontSize = "size14",
            TabLabel = "added text field",
            Height = "23",
            Width = "84",
            Required = "false",
            Bold = "true",
            Value = signerName,
            Locked = "false",
            TabId = "name"
        };

        // Add the tabs model (including the SignHere tab) to the signer.
        // The Tabs object wants arrays of the different field/tab types
        // Tabs are set per recipient/signer
        Tabs tabs = new Tabs
        {
            CheckboxTabs = new List<Checkbox> { ckAuthorization, ckAgreement },
            RadioGroupTabs = new List<RadioGroup> { radioGroup },
            TextTabs = new List<Text> { includedOnTemplate, addedField },
            ListTabs = new List<List> { colorPicker }
        };
Related