【问题标题】:DocuSign PHP SDK - How Do I Populate Existing Text Tabs Programmatically?DocuSign PHP SDK - 如何以编程方式填充现有文本选项卡?
【发布时间】:2018-12-16 05:32:13
【问题描述】:

我正在使用 DocuSign PHP SDK,我想为我的模板上的现有文本选项卡/字段填写值。

我尝试过使用以下方法:

$textTab = new \DocuSign\eSign\Model\Text();
$textTab->setTabId('f432a532-327e-4335-39ff-fk3285d732pd');
$textTab->setValue('3333 Kingman Ave');
$tabs = new DocuSign\eSign\Model\Tabs();
$tabs->setTextTabs(array($textTab));
$templateRole->setTabs($tabs);

其中传递给setTabId() 的参数取自模板 JSON 导出中 textTabs 数组中对象的 tabId 属性。

我也尝试过使用

$textTab->setTabLabel('corresponding-label-id') 

代替

$textTab->setTabId()  

两者都不会更改它们引用的选项卡中的值。使用 PHP SDK 为现有文本选项卡设置自定义值的正确语法是什么?

【问题讨论】:

  • 是'corresponding-label-id'模板中的标签标签,您在创建信封时引用它?
  • @AmitKBist 是的,它是文档上的标签标签
  • 能否请您在调用DocuSign平台时捕获并分享您的应用程序正在创建的DS API日志,您可以按照here说明的步骤捕获日志。请确保使用您在应用程序中使用的凭据启用日志记录。

标签: php docusignapi


【解决方案1】:

参见示例EG017SetTemplateTabValues.php

您通过角色对象为签名者/接收者设置值。

例如

    # create the envelope definition with the template_id
    $envelope_definition = new \DocuSign\eSign\Model\EnvelopeDefinition([
        'status' => 'sent', 'template_id' => $args['template_id']
    ]);
    # Set the values for the fields in the template
    $check1 = new \DocuSign\eSign\Model\Checkbox([
        'tab_label' => 'ckAuthorization', 'selected' => "true"]);
    $number1 = new \DocuSign\eSign\Model\Number([
        'tab_label' => "numbersOnly", 'value' => '54321']);
    $radio_group = new \DocuSign\eSign\Model\RadioGroup(['group_name' => "radio1",
        # You only need to provide the radio entry for the entry you're selecting
        'radios' => [
            new \DocuSign\eSign\Model\Radio(['value' => "white", 'selected' => "true"]),
        ]]);
    $text = new \DocuSign\eSign\Model\Text([
        'tab_label' => "text", 'value' => "Jabberwocky!"]);
    # Pull together the existing tabs in a Tabs object:
    $tabs = new \DocuSign\eSign\Model\Tabs([
        'checkbox_tabs' => [$check1, $check3], 'number_tabs' => [$number1],
        'radio_group_tabs' => [$radio_group], 'text_tabs' => [$text]]);
    # Create the template role elements to connect the signer and cc recipients
    # to the template
    $signer = new \DocuSign\eSign\Model\TemplateRole([
        'email' => $args['signer_email'], 'name' => $args['signer_name'],
        'role_name' => 'signer',
        'tabs' => $tabs # Set tab values
    ]);
    # Create a cc template role.
    $cc = new \DocuSign\eSign\Model\TemplateRole([
        'email' => $args['cc_email'], 'name' => $args['cc_name'],
        'role_name' => 'cc'
    ]);
    # Add the TemplateRole objects to the envelope object
    $envelope_definition->setTemplateRoles([$signer, $cc]);
    return $envelope_definition;

【讨论】:

  • 同样的结果。我打开了调试,返回的 JSON 显示带有传入标签和值的tabs 对象:"tabs":{"textTabs":[{"tabLabel":"testtwo","value":"34433 wwwwwaa"}]}。模板本身或关联的 API/集成器键上是否有设置选项可防止通过 API 调用设置自定义字段?
  • 没有您建议的设置。我建议您不要使用帐户自定义标签。首先尝试使用常规标签。首先让eg-03-php-auth-code-grant 运行,看看它如何设置模板选项卡的值。然后将其更新为您的用例。
  • 另外,用您请求的 json 更新您的问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-07-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-02
  • 1970-01-01
相关资源
最近更新 更多