Using Gravity Forms ‘gform_zohocrm_post_create_lead’ PHP action

The gform_zohocrm_post_create_lead action allows you to perform custom actions 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) {
    // your custom code here
}

Parameters

  • $lead_record (array): The response from Zoho CRM after a feed has successfully created a lead, with the lead id injected.
  • $lead (array): The lead arguments that you sent to Zoho CRM to initiate the creation process.
  • $feed (array): The feed object.
  • $entry (array): The entry object.
  • $form (array): The form object.

More information

See Gravity Forms Docs: gform_zohocrm_post_create_lead

This action was added in Zoho CRM version 1.8.

The source code is located in class-gf-zohocrm.php.

Examples

Send a custom notification after lead creation

This example sends a custom notification after the lead has been created. The notification must be configured to use a custom notification event already registered using the 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');
}

Add a note to the lead after creation

This example adds a note to the newly created lead in Zoho CRM.

add_action('gform_zohocrm_post_create_lead', 'add_note_after_lead_creation', 10, 5);

function add_note_after_lead_creation($lead_record, $lead, $feed, $entry, $form) {
    // Add a note to the created lead
    $lead_id = $lead_record['details']['id'];
    $note_content = 'This is a custom note added after lead creation.';

    // your custom code to add note to Zoho CRM using the lead_id and note_content
}

Log lead creation details

This example logs details of the lead creation process.

add_action('gform_zohocrm_post_create_lead', 'log_lead_creation_details', 10, 5);

function log_lead_creation_details($lead_record, $lead, $feed, $entry, $form) {
    // Log the lead creation details
    error_log('Lead created in Zoho CRM with ID: ' . $lead_record['details']['id']);
}