Description
This filter can be used to modify the record arguments before they are sent to Zoho CRM.
Usage
The following would apply to all feeds:
add_filter( 'gform_zohocrm_record', 'your_function_name', 10, 4 );
To target feeds for a specific form append the form id to the filter name. (format: gform_zohocrm_record_FORMID)
add_filter( 'gform_zohocrm_record_4', 'your_function_name', 10, 4 );
Parameters
- $record array
The record argument.
-
$module string
The module.
-
$feed Feed Object
The feed currently being processed.
-
$entry Entry Object
The entry currently being processed.
-
$form Form Object
The form currently being processed.
Example
This example shows how you can modify the record to set the Lead Assignment Rules ID (lar_id) for an entry before it is sent to Zoho CRM. You need to update the snippet with your form id number, feed name, and value for lar_id. Please read the snippet comments.
// Change 33 to the id number of your form. add_filter( 'gform_zohocrm_record_33', 'my_gform_zohocrm_record', 10, 5 ); function my_gform_zohocrm_record( $record, $module, $feed, $entry, $form ) { $feed_name = rgars( $feed, 'meta/feedName' ); // Change Your Feed Name Here to the name of the Zoho CRM feed. if ( $module === 'Leads' && $feed_name === 'Your Feed Name Here' ) { // Change to use your own lar_id. $record = array_merge( array( 'lar_id' => '123213' ), $record ); } return $record; }
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
$filtered_record = gf_apply_filters( array( 'gform_zohocrm_record', $record['form']['id'] ), $record, $module, $record['feed'], $record['entry'], $record['form'] );
This filter is located in GF_ZohoCRM_API::insert_record() in class-gf-zohocrm-api.php.