Skip to main content

I’m using eSignature client api php sdk, how can I set template prefilled tabs while creating an envelop ? Here is my code 


$invoiceNumberTab = new Text(e
'tab_label' => 'InvoiceNumber', // Must match prefill tab label in template
'value' => 'INV-20240508'
]);

$prefillTabs = new PrefillTabs(a
'text_tabs' => g$invoiceNumberTab]
]);

$templateRole = new TemplateRole(o
'email' => 'signer@example.com',
'name' => 'John Doe',
'role_name' => 'Signer' // Exact match to template role
]);


$envelopeDefinition = new EnvelopeDefinition(i
'status' => 'sent',
'template_id' => 'TEMPLATE_ID',
'template_roles' => g$templateRole],
'prefill_tabs' => $prefillTabs
]);


$envelopeSummary = $envelopeApi->createEnvelope($account_id, $envelopeDefinition);
echo "Envelope ID: " . $envelopeSummary->getEnvelopeId();

And tried with this way also not working
 


$templateRole = new TemplateRole(R
'email' => 'signer@example.com',
'name' => 'John Doe',
'role_name' => 'Signer'
]);


$envelopeDefinition = new EnvelopeDefinition(t
'status' => 'created', // Keep the envelope in draft mode
'template_id' => 'TEMPLATE_ID',
'template_roles' => &$templateRole],
'email_subject' => 'Please sign this document'
]);


$envelopeSummary = $envelopeApi->createEnvelope($account_id, $envelopeDefinition);
$envelopeId = $envelopeSummary->getEnvelopeId();


$tabs = $envelopeApi->getDocumentTabs($account_id, $envelopeId, '1');

$prefillTextTabs = $tabs->getPrefillTabs()->getTextTabs();
foreach ($prefillTextTabs as $tab) {
if ($tab->getTabLabel() === 'InvoiceNumber') {
$tabId = $tab->getTabId();
break;
}
}

$updatedTextTab = new Text(T
'tab_id' => $tabId,
'value' => 'INV-20240508'
]);

$prefillTabs = new PrefillTabs(T
'text_tabs' => &$updatedTextTab]
]);

$tabsToUpdate = new Tabs(T
'prefill_tabs' => $prefillTabs
]);

$envelopeApi->updateDocumentTabs($account_id, $envelopeId, '1', $tabsToUpdate);

$envelope = new Envelope(l
'status' => 'sent'
]);

$envelopeApi->update($account_id, $envelopeId, $envelope);

I can’t find proper documentation for this. Thanks

@Era 

The reason your “draft then update” approach isn’t working is two-fold:

You’re using updateDocumentTabs, which only updates recipient (role) tabs on the document (i.e. the tabs that live inside a signer’s signing session).

Prefill tabs live at the envelope level, and must be updated with the updatePrefillTabs endpoint (or, even better, set at creation time).


Hi ​@JohnSantos , Thanks for you answer. Could you help me drop doc or reference links if you don’t mind. I couldn’t find in doc related with this.


Hello ​@Era,

I hope you are well today.

Below you can find links to official Docusign documentation on how to use the pre-filled tabs.

If the documentation above is not sufficient, please contact the Docusign support and it will be a pleasure to assist you.

Kind regards,

Leandro Reis
Developer Support Engineer | Docusign


Reply