Docusign 使用 templateId 创建信封并为给定 templateid 中的字段设置值

问题描述 投票:0回答:1

我们正在为我们的应用程序实施文档签名集成。我正在进行以下 V2 API 调用

https://demo.docusign.net/restapi/v2/accounts/accountID/envelopes

传递以下参数

Array
(
    [status] => sent
    [emailSubject] => event registration waiver
    [templateId] => templateID
    [templateRoles] => Array
        (
            [0] => Array
                (
                    [roleName] => Test
                    [clientUserId] => 198128
                    [FullName] => Abraham Ray
                    [emailaddress] => [email protected]
                )

        )

)

但是我在信封中的字段数据没有预填充。

有人可以帮助我了解传递自定义字段标签的设置值需要哪些所有参数。

docusignapi
1个回答
0
投票

所以首先,我会使用 v2.1 而不是 v2.0。您没有理由使用旧版本的 API。

其次,您的代码不会显示任何选项卡的填充,您唯一要做的就是设置收件人信息(包括嵌入式签名所需的信息)

这里是 PHP 代码,它从模板创建信封并用值填充选项卡。请注意,必须正确设置模板才能使其工作。

https://github.com/docusign/code-examples-php/blob/master/src/Services/Examples/eSignature/SetTemplateTabValuesService.php

 $check1 = new Checkbox([
            'tab_label' => 'ckAuthorization', 'selected' => "true"]);
        $check3 = new Checkbox([
            'tab_label' => 'ckAgreement', 'selected' => "true"]);
        $number1 = new Number([
            'tab_label' => "numbersOnly", 'value' => '54321']);
        $radio_group = new RadioGroup(['group_name' => "radio1",
            # You only need to provide the radio entry for the entry you're selecting
            'radios' => [
                new Radio(['value' => "white", 'selected' => "true"]),
            ]]);
        $text = new Text([
            'tab_label' => "text", 'value' => "Jabberwocky!"]);

        # We can also add a new field to the ones already in the template:
        $text_extra = new Text([
            'document_id' => "1", 'page_number' => "1",
            'x_position' => "280", 'y_position' => "172",
            'font' => "helvetica", 'font_size' => "size14", 'tab_label' => "added text field",
            'height' => "23", 'width' => "84", 'required' => "false",
            'bold' => 'true', 'value' => $args['signer_name'],
            'locked' => 'false', 'tab_id' => 'name']);

        # Pull together the existing and new tabs in a Tabs object:
        $tabs = new Tabs([
            'checkbox_tabs' => [$check1, $check3], 'number_tabs' => [$number1],
            'radio_group_tabs' => [$radio_group], 'text_tabs' => [$text, $text_extra]]);

        # Create the template role elements to connect the signer and cc recipients
        # to the template
        $signer = new TemplateRole([
            'email' => $args['signer_email'], 'name' => $args['signer_name'],
            'role_name' => 'signer',
            'client_user_id' => $args['signer_client_id'], # change the signer to be embedded
            'tabs' => $tabs # Set tab values
        ]);
        # Create a cc template role.
        $cc = new 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]);
© www.soinside.com 2019 - 2024. All rights reserved.