Borhene Abidi
Borhene Abidi

Reputation: 19

Docusign add note in a template and prefill it before sending the envelope

i need to enter the signer address in a template docusign as a note field and prefill it when creating the envelope and before sending it. Thanks for help.

there is my php code:

$envelope_definition = new EnvelopeDefinition([
    'status' => 'sent', 'template_id' => $this->template_id
]);
# 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'
]);

$address_note = new Note(['selected' => 'true', 'tab_label' => 'signer_address', 'value' => $args['signer_address']]); $signer->setTabs(new Tabs([$address_note])); $envelope_definition->setTemplateRoles([$signer]);

and there is the configuration of note field in the dashboard docusign: note field

But the problem is when signing the document i can't see the signer address

When i try to find the tabs in the apropriate template using this php code :

# create the envelope definition with the template_id
    $envelope_definition = new EnvelopeDefinition([
        'status' => 'sent', 'template_id' => $this->template_id
    ]);
    # 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'
    ]);

    dd($signer->getTabs());

i got null as result.

Upvotes: 0

Views: 319

Answers (2)

Borhene Abidi
Borhene Abidi

Reputation: 19

Thanks for your help, i resolve the issue, the solution is :

    $envelope_definition = new EnvelopeDefinition([
        'status' => 'sent', 'template_id' => $this->template_id
    ]);

    $address_note = new Note(['selected' => "true", 'tab_label' => 'signer_address', 'value' => $args['signer_address']]);
    $tabs = new Tabs(['note_tabs' => [$address_note]]);
    $signer = new TemplateRole([
        'email'             => $args['signer_email'],
        'name'              => $args['signer_name'],
        'role_name'         => 'signer',
        'tabs'              => $tabs
    ]);

Upvotes: 0

Matthew Roknich
Matthew Roknich

Reputation: 908

Before you make your request, check to ensure that your template contains the appropriate note field that you want to prepopulate. You can do so by making a GET request to /templates.

GET https://demo.docusign.net/restapi/v2.1/accounts/{account_ID}/templates/{template_ID}?include=recipients,tabs

Now, To prepopulate a note field with the physical mailing address for a particular recipient, you can make a POST request to /envelopes. You will find the tabLabel from the previous step.

{
    "status": "sent",
    "templateId": "00df08bf-xxxx-xxxx-xxxx-ecaa2360c121",
    "templateRoles": [
        {
            "email": "[email protected]",
            "name": "ABC",
            "roleName": "signer",
            "routingOrder": "1",
            "tabs": {
                "noteTabs": [
                    {
                        "selected": "true",
                        "tabLabel": "userAddress",
                        "value": "theUsersAddressGoesHere"
                    }
                ]
            }
        },
        {
            "email": "[email protected]",
            "name": "EFG",
            "roleName": "cc",
            "routingOrder": "2"
        }
    ]
}

If you are unable to see the value of the note field when signing, you may need to change the size of the bounding box. You can do this either by editing the template in the UI or adding X/Y properties to your request.

Upvotes: 0

Related Questions