3
votes

Objective: Autopopulate some values using the tabLabel/value key pair for server templates, using the beta Docusign PHP Client.

I've looked at quite a few stackoverflow posts and unfortunately the one that seems to be the closest related to me seems unanswered: Docusign API - prefilling tab values on envelope created from template

I was unable to find this "SecureField" option in any sort of preferences.

Currently, the name field fills in automatically just because of the template role being set accurately. I didn't have to do this with the tabLabel key, this was done automatically. I have tried creating a company tab, and that fails to autopopulate, so does a random text tab I have tried.

I have currently forked the library and made it PSR-4 compatible, and to achieve this objective I changed the following files:

TemplateRole Model: Modified the constructor to include $tabs, and set $this->tabs if $tabs is set. I added two functions getTabs()/setTabs($tabs) that behave the same as get/set RoleName, Name, Email, etc.

RequestSignatureResource: In the foreach ($templateRoles as $templateRole) I added a 'tabs' key to the array_pusy, and put $templateRole->getTabs().

I created a new TemplateRole('role name', 'person name', 'email', $tabs).

I can see the tabs in the JSON request data. Is there anything I'm missing?

I should also note that I used this post for inspiration, too: How to pre-fill tabs on a server template with the DocuSign API. The issue with this is that if I put textTabs:{text:{tabLabel:"something", value:"some value"}} then I get a response from the API that my request was invalid. I can provide that specific error upon request if needed.

1
Probably the easiest way to debug/diagnose this is to post the raw request your code is sending out here. Then we can inspect for validity and you can ensure that your tab labels and names are correct both in your request, and in the template you have already created. You can use the request logging button in your account preferences to easily capture your requests/responses.Ergin
@Ergin, sorry for the late response. I didn't have email notifications on and got sidetracked. This is from the log file named Created_CreateEnvelopeFromTemplatesAndForms.txt: gist.github.com/FatBoyXPC/d108a9d85c790ef43278FatBoyXPC

1 Answers

3
votes

The following worked for me :

  $templateRole = new DocuSign\eSign\Model\TemplateRole();
  $templateRole->setClientUserId($email);
  $templateRole->setEmail($email);
  $templateRole->setName($recipientName);
  $templateRole->setRoleName($templateRoleName);

  $textTab = new \DocuSign\eSign\Model\Text();
  // I added this text field manually on docuSign site.
  $textTab->setTabLabel("Field Label");
  $textTab->setValue('Value');

  $tabs = new DocuSign\eSign\Model\Tabs();
  $tabs->setTextTabs(array($textTab));

  $templateRole->setTabs($tabs);