在DocuSign中模板上的预填充标签

时间:2020-05-18 00:25:09

标签: c# jwt docusignapi

我正在使用从DocuSign开发页面链接的C#JWT-framework.sln。

我在演示环境中使用了API,我可以执行以下各项:

  1. 发送带有签名块位置控制位置的信封。
  2. 发送信封并动态添加标签,并为这些标签设置位置和设置值。
  3. 检索已签名的信封。
  4. 使用预定义的模板发送信封。

下面的代码使用我的模板生成一个信封...但是我无法忍受我的生命,弄清楚如何获取模板中存在的选项卡对象的列表,以便我可以在之前使用数据预先填充它们路由信封以进行签名。

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

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

我想我需要使用TemplateTabs类,但是我找不到任何示例来说明如何遍历模板上的所有选项卡,然后根据选项卡ID更新特定的选项卡。

任何帮助将不胜感激。

谢谢 无限

1 个答案:

答案 0 :(得分:2)

我们有一个code example向您展示如何执行此操作。

(当然,您的模板是不同的,只是为了给您一个主意)

C# relevant snippet在这里:

 // 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 }
        };