gform_zohocrm_post_create_lead

Description

Allows custom actions to be performed after creating a lead with a Zoho CRM feed.

Usage

add_action( 'gform_zohocrm_post_create_lead', 'action_after_lead_creation', 10, 5 );
function action_after_lead_creation( $lead_record, $lead, $feed, $entry, $form  ) {
// Do your stuff
}

Parameters

  • $lead_record array

    The response from Zoho CRM after a feed has successfully created a lead, with the lead id injected.


    Sample array:

array
(
    'code' => 'SUCCESS'
    'duplicate_field' => ''
    'action' => 'insert'
    'details' => array
        (
            'Modified_Time' => '2019-08-08T12:15:47-07:00' //System-generated modification timestamp
            'Modified_By' => array // Name and ID of the user who modified the lead.
                (
                    'name' => 'Silvia Samples'
                    'id' => 3451042000000292017
                )
​
            'Created_Time' => '2019-08-08T12:15:47-07:00' // System-generated creation timestamp.
            'id' => 3351042000000745001 // Unique ID of the lead
            'Created_By' => array // Name and ID of the user who created the lead.
                (
                    'name' => 'Silvia Samples'
                    'id' => 3451042000000292017
                )
​
        )
​
    'message' => 'record added'
    'status' => 'success'
)
  • $lead array

    The lead arguments that you sent to Zoho CRM to initiate the creation process. It includes entry fields as per your Zoho feed field mappings, and the feed options you have set.

    Note regarding duplicateCheck:
    duplicateCheck value of 1 is equivalent to the feed options of Update Contact If Already Exists = false, and Allow Duplicate = false. That is, feed will only create contact if it does not exist already.
    duplicateCheck value of 2 is equivalent to the feed options of Update Contact If Already Exists = true, and Allow Duplicate = false. That is, feed will update a matching contact if it exists already.

    A sample array may be:
array
(
    'Email_Opt_Out' => '' //feed setting 
    'Description' => ''  //Lead description, as per Zoho definitions.
    'Lead_Source' => 'Partner'  //Source from which the lead was created, as per Zoho definitions.
    'Lead_Status' =>     'Rating' => 'Contact in Future' //Status of the lead, as per Zoho definitions.
    'Rating' => 'Contact in Future'  //The rating of the lead, as per Zoho definitions.
 
    'options' => 'array
        (
            'duplicateCheck' => 1 //value of 1 or 2. See note below.
            'isApproval' => '' //the Approval Mode from the feed settings
            'wfTrigger' => '' //the Workflow Mode from the feed settings
        )
​
    // Fields that have been mapped in the Zoho feed, and their values collected from the entry.
    'Company' => 'Sample Company'
    'Email' => '[email protected]'
    'First_Name' => 'Silvia'
    'Last_Name' => 'Samples'
)
  • $feed array

    The feed object.

  • $entry array

    The entry object.

  • $form array

    The form object.

Example

The following example will send a notification after the lead creation. The notification must be configured to use a custom notification event already registered using gform_notification_events filter.

add_action( 'gform_zohocrm_post_create_lead', 'send_notification_after_lead', 10, 5 );
function send_notification_after_lead( $lead_record, $lead, $feed, $entry, $form  ) {
    // Send a notification configured to use the custom Event zoho_lead
    GFAPI::send_notifications( $form, $entry, 'zoho_lead' );
}

Since

This filter was added in Zoho CRM version 1.8.

Source Code

This filter is located in class-gf-zohocrm.php.