phpdocusignapicustom-tag

DocuSign REST API (PHP) - pre-fill custom tags


I am working on project in which I need to use DocuSign API (PHP). This is my first experience with DocuSign and I successfully made template in DocuSign Console with roleName = signer. There I also made Custom Text Tags: address, city, state and phone and drag them to the desired location in my template. I want there to put my customer (signer) information from project database.

From my project I successfully made connection with DocuSign via PHP API and receive Embedded Singing View URL which opens my template where the user can sign document without problem.

But... all my custom text tags are empty and signer can type into them. I need to pre-fill them with signer personal data which is coming from database. I triple check custom tag label spelling, upper/lower case in my DocuSign Console and in my code as well as roleName->tagLabel relation. My PHP code is below.

Can someone, please, tell me what I am doing wrong?

I lost two days on it.

$data = array(
"accountId" => $accountId,
"emailSubject" => $this->_emailSubject,
"templateId" => $templateId,
"templateRoles" => array(
               array(
                   "email" => $email,
                   "name" => $recipientName,
                   "clientUserId" => $clientUserId,
                   "roleName" => "signer",
                   "customFields" => array(
                                "textCustomFields" => array (
                                                      array (
                                                          "name" => "address",
                                                          "value" => "Address from DB",
                                                          "show" => "true",
                                                          ),
                                                      array (
                                                          "name" => "city",
                                                          "value" => "City from DB",
                                                          "show" => "true",
                                                          ),
                                                      array (
                                                          "name" => "state",
                                                          "value" => "State from DB",
                                                          "show" => "true",
                                                          ),
                                                      array (
                                                          "name" => "phone",
                                                          "value" => "Phone from DB",
                                                          "show" => "true",
                                                          ),

                                               ),
                                     ),
                ),
                  ),
"status" => "sent"
); 

Solution

  • You need to use the textTabs type in your JSON, not customFields which is used for something else. For instance, if you drag a Data Field from the UI onto the document and give it name address, to pre-fill that field you would need to reference it's tabLabel and value fields like this:

    "roleName" => "signer",
    "tabs" => array(
        "textTabs" => array(
            array(
                "tabLabel"=> "address",
                "value" => "123 Main St."
            ) 
        )
    )