This documentation page is for Quform version 1 and may not be applicable for Quform 2 click here to visit the documentation for Quform 2.

This guide will show you how to add a new lead to Zoho CRM when a user submits a Quform form. In this guide we’ll create a new plugin to contain the code needed for the integration to work.

Step 1 – create a WordPress plugin

Create a new folder named quform-zoho-integration and inside it create a file named quform-zoho-integration.php

Inside the quform-zoho-integration.php file add the following code.

1
2
3
4
5
6
7
8
910
11
1213
14
15
16
17
18192021
22
23
24
25
26
27
28
<?php
 
/*
 * Plugin Name: Quform Zoho Integration
 * Description: Add leads to Zoho CRM from Quform forms.
 * Version: 1.0
 */
 
add_filter('iphorm_post_process_1', function (iPhorm $form) {    require 'vendor/autoload.php';
 
    $client = new CristianPontes\ZohoCRMClient\ZohoCRMClient('Leads', 'yourAuthToken'); 
    try {
        $client->insertRecords()
            ->setRecords(array(
                array(
                    'First Name' => $form->getValue('iphorm_1_3'),                    'Last Name' => $form->getValue('iphorm_1_4'),                    'Email' => $form->getValue('iphorm_1_5')                )
            ))->request();
    } catch (Exception $e) {
        if (defined('WP_DEBUG') && WP_DEBUG) {
            iphorm_error_log($e);
        }
    }
});
<?php

/*
 * Plugin Name: Quform Zoho Integration
 * Description: Add leads to Zoho CRM from Quform forms.
 * Version: 1.0
 */

add_filter('iphorm_post_process_1', function (iPhorm $form) {
    require 'vendor/autoload.php';

    $client = new CristianPontes\ZohoCRMClient\ZohoCRMClient('Leads', 'yourAuthToken');

    try {
        $client->insertRecords()
            ->setRecords(array(
                array(
                    'First Name' => $form->getValue('iphorm_1_3'),
                    'Last Name' => $form->getValue('iphorm_1_4'),
                    'Email' => $form->getValue('iphorm_1_5')
                )
            ))->request();
    } catch (Exception $e) {
        if (defined('WP_DEBUG') && WP_DEBUG) {
            iphorm_error_log($e);
        }
    }
});
  • On line 9, replace the number 1 with the form ID
  • On line 12, replace yourAuthToken with your Zoho CRM auth token
  • On line 18, replace iphorm_1_3 with the First Name element unique ID
  • On line 19, replace iphorm_1_4 with the Last Name element unique ID
  • On line 20, replace iphorm_1_5 with the Email element unique ID

Step 2 – install the Zoho CRM PHP client

Next you need to install the Zoho CRM PHP client using composer. You can do this on your computer or on the web server. In a terminal navigate to the directory of the plugin you created in Step 1, then run this command:

composer require cristianpontes/zoho-crm-client-php

This will install all required files into the vendor folder within the plugin. Upload the quform-zoho-integration folder to the web server at wp-content/plugins then go to the Plugins page within WordPress and activate the plugin Quform Zoho Integration and you’re done.

Troubleshooting

If the integration does not work, try temporarily enabling debug logging then submit the form again and check for an error message in the wp-content/debug.log file.

Be inspired. © 2018 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy