Description
This filter can be used to modify the task arguments before they are sent to Zoho CRM.
Usage
The following would apply to all feeds:
add_filter( 'gform_zohocrm_task', 'your_function_name', 10, 4 );
To target feeds for a specific form append the form id to the hook name. (format: gform_zohocrm_task_FORMID)
add_filter( 'gform_zohocrm_task_4', 'your_function_name', 10, 4 );
Parameters
- $task array
The task arguments are an associative array.
array(
'Due Date' => '2015-10-15',
'Subject' => 'some text',
'Status' => 'Not Started',
'SMOWNERID' => 'The-Zoho-CRM-User-ID-Here',
'CONTACTID' => 'The-Zoho-CRM-Contact-ID-Here',
'SEID' => 'The-Zoho-CRM-Lead-Or-Contact-ID-Here',
'SEMODULE' => 'Leads' /* or Contacts */
)
$feed Feed Object
The feed currently being processed.
$entry Entry Object
The entry currently being processed.
$form Form Object
The form currently being processed.
Examples
Append text to Subject
This example shows how you can append some text to the ‘Subject’ argument based on a field value in the Entry Object.
add_filter( 'gform_zohocrm_task_4', 'change_task_argument', 10, 4 );
function change_task_argument( $task, $feed, $entry, $form ) {
if ( rgars( $feed, 'meta/feedName') == 'Zoho CRM Feed 2' && rgar( $entry, '5' ) == 'No' ) {
$task['Subject'] .= ' - some more text';
}
return $task;
}
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Source Code
gf_apply_filters( 'gform_zohocrm_task', $form['id'], $task, $feed, $entry, $form );
This filter is located in GFZohoCRM::create_task() in class-gf-zohocrm.php.