I'm using the Docusign PHP SDK to create an envelope using a PDF with pre-existing form fields.
The fields are correctly being parsed by Docusign and show up on the resulting document.
However, I can't find a way to prefill some of those fields.
// Create document model
$document = new Document([
'document_base64' => $base64_content,
'name' => 'Document',
'file_extensions' => 'pdf',
'document_id' => 1, 'transform_pdf_fields' => true
]);
$signer = new Signer([
'email' => $args['client_email'],
'name' => $args['client_name'],
'recipient_id' => 1,
'routing_order' => 1,
'client_user_id' => $args['client_user_id']
]);
// This is the attempt to prefill the fields
// by using the same label as the PDF form.
// But it does nothing.
$text1 = new Text([
'tab_label' => 'field_one', 'value' => $args['client_coverage'],
]);
$text2 = new Text([
'tab_label' => 'field_two', 'value' => $args['client_term'],
]);
$signer->setTabs(new Tabs(['text_tabs' => [$text1, $text2]]));
$definition = new EnvelopeDefinition([
'email_subject' => "Please sign this document",
'documents' => [$document],
'recipients' => new Recipients(['signers' => [$signer]]),
'status' => 'sent',
]);
A call to the envelope tabs API shows the tabs in question with the exact tab label but the value is blank.
Any suggestions would be very appreciated! Thanks.
P.S. I can, after the envelope creation, get the document tabs, in order to get their IDs, and then make another request to update those.
So this is doable in 3 calls but I have a feeling that it should be possible to do in one - when the envelope is created initially.