gform_capsulecrm_opportunity

gform_capsulecrm_opportunity

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
This filter allows the Capsule CRM Opportunity object to be modified before it is created.
Usage
The following would apply to all forms:
add_filter( 'gform_capsulecrm_opportunity', 'your_function_name', 10, 4 );

To target a specific form, append the form id to the hook name. (format: gform_capsulecrm_opportunity_FORMID)
add_filter( 'gform_capsulecrm_opportunity_1', 'your_function_name', 10, 4 );

To target a specific feed for a form, append the form id and feed id to the hook name. (format: gform_capsulecrm_opportunity_FORMID_FEEDID)
add_filter( 'gform_capsulecrm_opportunity_1_7', 'your_function_name', 10, 4 );

Parameters

$opportunity array
Capsule CRM opportunity.
array (
'name' => 'Capsule CRM',
'description' => 'Test Case',
'party' =>
array (
'id' => 179884585
),
'milestone' =>
array(
'name' => 'Meeting'
),
'owner' =>
array(
'username' => 'testuser'
)
)

$form Form Object
The current form.

$entry Entry Object
The current entry.

$feed Feed Object
The current feed.

Examples
add_filter( 'gform_capsulecrm_opportunity', 'change_opportunity_object', 10, 4 );
function change_opportunity_object( $opportunity, $form, $entry, $feed ){
$opportunity['description'] = 'Opportunity Created by API';
return $opportunity;
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms Capsule CRM Add-On version 1.2.
Source Code
This filter is located in GFCapsuleCRM::create_opportunity() in class-gf-capsulecrm.php.

gform_{$SHORT_SLUG}_field_value

gform_{$SHORT_SLUG}_field_value

DescriptionShort Slug ValuesUsageParametersExamples1. ActiveCampaign – Use Choice Text Instead of Value2. ActiveCampaign – Replace Commas with Pipes3. Emma – Format Checkbox Field4. Help Scout – Change Value of Specific Field5. Zoho CRM – Format Date Field6. Zoho CRM – Format Checkbox FieldPlacementSinceSource Code

Description
This filter can be used to modify a value before it is sent to a third-party by one of the Add-On Framework based add-ons. If you want to filter the value for any add-on you can use gform_addon_field_value.
Short Slug Values
The Gravity Forms Add-On Slugs article lists the available short slugs to use with this hook:
The following add-ons listed in the slug article do not use the hook:

Gravity Forms CLI Add-On
Gravity Forms Debug Add-On
Gravity Forms Gutenberg Add-On

The Zapier Add-On implements its own version of the hook:

gform_zapier_field_value

Usage
The base filter which would run for all forms and all fields would be used like so:
1add_filter( 'gform_helpscout_field_value', 'your_function_name', 10, 4 );
To target a specific form append the form id to the hook name. (format: gform_{$SHORT_SLUG}_field_value_FORMID)
1add_filter( 'gform_helpscout_field_value_10', 'your_function_name', 10, 4 );
To target a specific field append both the form id and the field id to the hook name. (format: gform_{$SHORT_SLUG}_field_value_FORMID_FIELDID)
1add_filter( 'gform_helpscout_field_value_10_3', 'your_function_name', 10, 4 );

Parameters

$value string
The value to be modified.

$form Form Object
The form currently being processed.

$entry Entry Object
The entry currently being processed.

$field_id string
The ID of the field currently being processed.

Examples
1. ActiveCampaign – Use Choice Text Instead of Value
This example shows how you can replace the value of a choice based survey field with the choice text.
1234567891011add_filter( 'gform_activecampaign_field_value', 'gf_get_choice_text', 10, 4 );function gf_get_choice_text( $value, $form, $entry, $field_id ) {    gf_activecampaign()->log_debug( __METHOD__ . '(): running.' );    $field = GFAPI::get_field( $form, $field_id );     if ( is_object( $field ) && $field->type == 'survey' ) {        $value = $field->get_value_export( $entry, $field_id, true );        gf_activecampaign()->log_debug( __METHOD__ . '(): Value: ' . $value );    }    return $value;}
2. ActiveCampaign – Replace Commas with Pipes
This example shows how you can replace the commas used to separate checkbox or multi select choices with pipe characters.
123456789101112add_filter( 'gform_activecampaign_field_value', 'gf_replace_commas_with_pipes', 10, 4 );function gf_replace_commas_with_pipes( $value, $form, $entry, $field_id ) {    gf_activecampaign()->log_debug( __METHOD__ . '(): running.' );    $field = GFAPI::get_field( $form, $field_id );     if ( is_object( $field ) && ( $field->type == 'checkbox' || $field->type == 'multiselect' ) ) {        $value = str_replace( ', ', '||', $value );        gf_activecampaign()->log_debug( __METHOD__ . '(): Value: ' . $value );    }     return $value;}
3. Emma – Format Checkbox Field
This example shows how you can reformat the checkbox field value to be passed as an array instead of a string.
123456789add_filter( 'gform_emma_field_value', function ( $value, $form, $entry, $field_id ) {    $field = GFAPI::get_field( $form, $field_id );     if ( is_object( $field ) && $field->get_input_type() === 'checkbox' ) {        $value = explode( ', ', $value );    }     return $value;}, 10, 4 );
4. Help Scout – Change Value of Specific Field
This example shows how you can change the value of field 3 on form 10 before it is passed to Help Scout.
1234add_filter( 'gform_helpscout_field_value_10_3', function ( $value, $form, $entry, $field_id ) {     return 'your new value';}, 10, 4 );
5. Zoho CRM – Format Date Field
This example shows how you can reformat the entry date from yyyy-mm-dd to the format configured on the field.
123456789add_filter( 'gform_zohocrm_field_value', function ( $value, $form, $entry, $field_id ) {    $field = GFAPI::get_field( $form, $field_id );     if ( is_object( $field ) && $field->type == 'date' ) {        $value = GFCommon::date_display( $value, $field->dateFormat );    }     return $value;}, 10, 4 );
6. Zoho CRM – Format Checkbox Field
This example shows how you can reformat the checkbox field value to pass true or false instead of the choice. This snippet is not needed if you』re using version 1.8 of the add-on or newer.
1234567891011add_filter( 'gform_zohocrm_field_value', function ( $value, $form, $entry, $field_id ) {    gf_zohocrm()->log_debug( __METHOD__ . '(): Running...' );    $field = GFAPI::get_field( $form, $field_id );     if ( is_object( $field ) && $field->get_input_type() === 'checkbox' ) {        gf_zohocrm()->log_debug( __METHOD__ . '(): Checkbox value to true or false.' );        $value = $value ? 'true' : 'false';    }     return $value;}, 10, 4 );
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms 1.9.10.11.
Source Code
1234gf_apply_filters( "gform_{$slug}_field_value", array(    $form['id'],    $field_id), $field_value, $form, $entry, $field_id );
This filter is located in GFAddOn::maybe_override_field_value() in includes/addon/class-gf-addon.php.

gform_capsulecrm_case

gform_capsulecrm_case

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
This filter allows the Capsule CRM Case object to be modified before it is created.
Usage
The following would apply to all forms:
add_filter( 'gform_capsulecrm_case', 'your_function_name', 10, 4 );

To target a specific form, append the form id to the hook name. (format: gform_capsulecrm_case_FORMID)
add_filter( 'gform_capsulecrm_case_1', 'your_function_name', 10, 4 );

To target a specific feed for a form, append the form id and feed id to the hook name. (format: gform_capsulecrm_case_FORMID_FEEDID)
add_filter( 'gform_capsulecrm_case_1_7', 'your_function_name', 10, 4 );

Parameters

$case array
Capsule CRM case.
array (
'name' => 'Capsule CRM',
'description' => 'Test Case',
'status' => 'OPEN',
'party' =>
array (
'id' => 179884585,
'owner' =>
array (
'username' => 'testuser'
)
)
)

$form Form Object
The current form.

$entry Entry Object
The current entry.

$feed Feed Object
The current feed.

Examples
add_filter( 'gform_capsulecrm_case', 'change_case_object', 10, 4 );
function change_case_object( $case, $form, $entry, $feed ){
$case['description'] = 'Created by API';
return $case;
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms Capsule CRM Add-On version 1.2.
Source Code
This filter is located in GFCapsuleCRM::create_case() in class-gf-capsulecrm.php.

gform_campfire_message

gform_campfire_message

DescriptionUsageParametersExamples1. All feeds2. Specific feedPlacementSource Code

Description
This filter is used to dynamically alter the message before it is sent to Campfire.
Usage
The following would apply to all feeds:
add_filter( 'gform_campfire_message', 'your_function_name', 10, 4 );

To target feeds for a specific form append the form id to the hook name. (format: gform_campfire_message_FORMID)
add_filter( 'gform_campfire_message_4', 'your_function_name', 10, 4 );

Parameters

$message string
The message to be sent to Campfire.

$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
1. All feeds
This example shows how you can change the message.
add_filter( 'gform_campfire_message', 'change_message', 10, 4 );
function change_message( $message, $feed, $entry, $form ) {

return 'your new message';
}

2. Specific feed
This example shows how you can change the message for a specific feed.
add_filter( 'gform_campfire_message_4', 'change_another_message', 10, 4 );
function change_another_message( $message, $feed, $entry, $form ) {
if ( rgars( $feed, 'meta/feedName' ) == 'Campfire Feed 2' ) {
$message = 'your new message';
}

return $message;
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
gf_apply_filters( 'gform_campfire_message', $form['id'], rgars( $feed, 'meta/message' ), $feed, $entry, $form )

This filter is located in GFCampfire::process_feed() in class-gf-campfire.php.

gform_campaignmonitor_override_subscriber

gform_campaignmonitor_override_subscriber

DescriptionUsageParametersExamples1. Add RestartSubscriptionBasedAutoresponders parameterPlacementSource Code

Description
This filter can be used to modify the subscriber parameters before they are sent to Campaign Monitor.
Usage
The filter which would run for all Campaign Monitor feeds can be used like so:
add_filter( 'gform_campaignmonitor_override_subscriber', 'your_function_name', 10, 4 );

Parameters

$subscriber array
An associative array containing all the parameters to be passed to Campaign Monitor.

$form Form Object
The Form which is currently being processed.

$entry Entry Object
The Entry which is currently being processed.

$feed Feed Object
The Feed which is currently being processed.

Examples
1. Add RestartSubscriptionBasedAutoresponders parameter
This example shows how you can add the RestartSubscriptionBasedAutoresponders parameter to the subscriber array. This will restart the any automated workflows for resubscribed subscribers, more details in Campaign Monitor API docs.
add_filter( 'gform_campaignmonitor_override_subscriber', function ( $subscriber, $entry, $form, $feed ) {
$subscriber['RestartSubscriptionBasedAutoresponders'] = true;

return $subscriber;
}, 10, 4 );

Placement
Your code snippet should be placed in the functions.php file of your active theme.
Source Code
apply_filters( 'gform_campaignmonitor_override_subscriber', $subscriber, $entry, $form, $feed )

This filter is located in GFCampaignMonitor::export_feed() in class-gf-campaignmonitor.php.

gform_campaignmonitor_override_blank_custom_fields

gform_campaignmonitor_override_blank_custom_fields

DescriptionUsageParametersExamples1. Override all feeds2. Override specific feedPlacementSource Code

Description
This filter can be used to modify how the add-on handles blank custom fields. The default behaviour is to remove custom fields which don』t have a value from the CustomFields array so they aren』t sent to Campaign Monitor.
Usage
The filter which would run for all Campaign Monitor feeds can be used like so:
add_filter( 'gform_campaignmonitor_override_blank_custom_fields', 'your_function_name', 10, 4 );

Parameters

$override boolean
The default is false.

$entry Entry Object
The Entry which is currently being processed.

$form Form Object
The Form which is currently being processed.

$feed Feed Object
The Feed which is currently being processed.

Examples
1. Override all feeds
The following example shows how you can apply the filter to all Campaign Monitor feeds.
add_filter( 'gform_campaignmonitor_override_blank_custom_fields', '__return_true' );

2. Override specific feed
The following example shows how you can target a specific Campaign Monitor feed.
add_filter( 'gform_campaignmonitor_override_blank_custom_fields', function ( $override, $entry, $form, $feed ) {
$feed_name = rgars( $feed, 'meta/feedName' );

return $feed_name == 'Your feed name' ? true : false;
}, 10, 4 );

Placement
Your code snippet should be placed in the functions.php file of your active theme.
Source Code
apply_filters( 'gform_campaignmonitor_override_blank_custom_fields', false, $entry, $form, $feed )

This filter is located in GFCampaignMonitor::export_feed() in class-gf-campaignmonitor.php.

gform_campaignmonitor_field_value

gform_campaignmonitor_field_value

DescriptionUsageParametersExamples1. Use GF_Field::get_value_export2. Change Signature ValuePlacementSource CodeSince

Description
This filter can be used to modify a value before it is sent to Campaign Monitor.
Usage
The base filter which would run for all forms and all fields would be used like so:
add_filter( 'gform_campaignmonitor_field_value', 'your_function_name', 10, 4 );

To target a specific form append the form id to the hook name. (format: gform_campaignmonitor_field_value_FORMID)
add_filter( 'gform_campaignmonitor_field_value_10', 'your_function_name', 10, 4 );

To target a specific field append both the form id and the field id to the hook name. (format: gform_campaignmonitor_field_value_FORMID_FIELDID)
add_filter( 'gform_campaignmonitor_field_value_10_3', 'your_function_name', 10, 4 );

Parameters

$value string
The value to be modified.

$form_id integer
The ID of the form being processed.

$field_id string
The ID of the field being processed.

$entry Entry Object
The entry currently being processed.

Examples
1. Use GF_Field::get_value_export
This example shows how you can have versions of the Campaign Monitor add-on older than 3.4 use GF_Field::get_value_export() to format the field value for export. Requires a minimum of Gravity Forms 1.9.12.4.
add_filter( 'gform_campaignmonitor_field_value', 'format_entry_value', 10, 4 );
function format_entry_value( $value, $form_id, $field_id, $entry ) {
$form = GFAPI::get_form( $form_id );
$field = GFFormsModel::get_field( $form, $field_id );

if ( is_object( $field ) ) {
$value = $field->get_value_export( $entry, $field_id, true );
}

return $value;
}

2. Change Signature Value
This example shows how you can send the url of the signature image.
add_filter( 'gform_campaignmonitor_field_value', 'change_signature_value', 10, 4 );
function change_signature_value( $value, $form_id, $field_id, $entry ) {
$form = GFAPI::get_form( $form_id );
$field = GFFormsModel::get_field( $form, $field_id );

if ( is_object( $field ) && $field->get_input_type() == 'signature' ) {
$value = RGFormsModel::get_upload_url_root() . 'signatures/' . $value;
}

return $value;
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
gf_apply_filters( 'gform_campaignmonitor_field_value', array( $form['id'], $field_id ), $field_value, $form['id'], $field_id, $entry )

This filter is located in GFCampaignMonitor::maybe_override_field_value() in class-gf-campaignmonitor.php.
Since
The base filter was added in version 2.5. The form and field specific versions were added in version 3.4.

gform_calculation_result

gform_calculation_result

DescriptionUsageJavaScript VersionParametersExamplePlacementSource CodePHP VersionParametersExamplePlacementSource Code

Description
This filter can be used to modify the result of a number field calculation or calculated product field.
Usage
The gform_calculation_result filter has both a JavaScript version and a PHP version. Both versions should be used.
The JavaScript version only overrides the calculation result on the front-end.
12345gform.addFilter( 'gform_calculation_result', function( result, formulaField, formId, calcObj ) {    // do stuff     return result;} );
The PHP version overrides the calculation result when the calculation is rerun during submission using the field values saved in the entry.
12345add_filter( 'gform_calculation_result', function( $result, $formula, $field, $form, $entry ) {    // do stuff     return $result;}, 10, 5 );
JavaScript Version

Parameters

result float
The calculation result.

formulaField Javascript Object
The current calculation field object. e.g.
1{"field_id":3,"formula":"{:1}+{:2}","rounding":""}

formId integer
The ID of the form in use.

calcObj Javascript Object
The calculation object.

Example
This example shows how you can perform a calculation using exponents.
12345678gform.addFilter('gform_calculation_result', function( result, formulaField, formId, calcObj ) {    if ( formId == '10' && formulaField.field_id == '3' ) {        var exponent = calcObj.replaceFieldTags( formId, '{:2}', formulaField ),            num = calcObj.replaceFieldTags( formId, '{:1}', formulaField );        result = Math.pow( num, exponent );    }    return result;} );
Placement
Your code snippet can be placed in a HTML field on your form or in a theme custom JavaScript file.
Source Code
This filter is located in js/gravityforms.js
PHP Version

Parameters

$result float
The calculation result.

$formula string
The formula after merge tags have been processed.

$field Field Object
The calculation field currently being processed.

$form Form Object
The form currently being processed.

$entry Entry Object
The entry currently being processed.

Example
This example shows how you can perform a calculation using exponents.
123456789add_filter( 'gform_calculation_result', function ( $result, $formula, $field, $form, $entry ) {    if ( $form['id'] == 10 && $field['id'] == 3 ) {        $exponent = (float) rgar( $entry, '2' );        $num      = (float) rgar( $entry, '1' );        $result   = pow( $num, $exponent );    }     return $result;}, 10, 5 );
Placement
Your code snippet should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFCommon::calculate() in common.php

gform_calculation_formula

gform_calculation_formula

DescriptionUsageJavaScript VersionParametersJS ExamplePlacementSource CodePHP VersionParametersPHP ExamplePlacementSource Code

Description
This filter can be used to dynamically modify the formula of a number field calculation or calculated product field.
Usage
The gform_calculation_formula filter has both a JavaScript version and a PHP version. Both versions should be used.
The JavaScript version only overrides the calculation formula on the front-end.
12345gform.addFilter( 'gform_calculation_formula', function( formula, formulaField, formId, calcObj ) {    // do stuff     return formula;} );
The PHP version overrides the calculation formula when the calculation is rerun during submission using the field values saved in the entry.
12345add_filter( 'gform_calculation_formula', function( $formula, $field, $form, $entry ) {    // do stuff     return $formula;}, 10, 4 );
JavaScript Version

Parameters

formula string
The calculation formula.

formulaField Javascript Object
The current calculation field object. e.g.
1{"field_id":3,"formula":"{:1}+{:2}","rounding":""}

formId integer
The ID of the form in use.

calcObj Javascript Object
The calculation object.

JS Example
123456gform.addFilter( 'gform_calculation_formula', function( formula, formulaField, formId, calcObj ) {    if ( formId == '10' && formulaField.field_id == '3' ) {        formula += '+5';    }    return formula;} );
Placement
Your code snippet can be placed in a HTML field on your form or in a theme custom JavaScript file.
Source Code
This filter is located in js/gravityforms.js
PHP Version

Parameters

$formula string
The calculation formula.

$field Field Object
The calculation field currently being processed.

$form Form Object
The form currently being processed.

$entry Entry Object
The entry currently being processed.

PHP Example
12345678add_filter( 'gform_calculation_formula', 'change_formula', 10, 4 );function change_formula( $formula, $field, $form, $entry ) {    if ( $form['id'] == 10 && $field->id == 3 ) {        $formula .= '+5';    }     return $formula;}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFCommon::calculate() in common.php

gform_calculation_format_result

gform_calculation_format_result

DescriptionUsageParametersExamplesFormat the number field with id 1 as currency.Show always two decimals.PlacementSource Code

Description
The 「gform_calculation_format_result」 filter can be used to override the default formatting for a calculated result.
Usage
The gform_calculation_result filter is a JavaScript filter.
gform.addFilter( 'gform_calculation_format_result', function( result, formulaField, formId, calcObj ) {
// do stuff

return result;
} );

Parameters

result float
The calculation result.

formulaField Javascript Object
The current calculation field object. e.g.
{"field_id":3,"formula":"{:1}+{:2}","rounding":""}

formId integer
The ID of the form in use.

calcObj Javascript Object
The calculation object.

Examples
Format the number field with id 1 as currency.

Show always two decimals.

Placement
Your code snippet can be placed in a HTML field on your form or in a theme custom JavaScript file.
Source Code
This filter is located in js/gravityforms.js.