Using Gravity Forms ‘gform_{$SHORT_SLUG}_field_value’ PHP action

The gform_{$SHORT_SLUG}_field_value action modifies a value before it is sent to a third-party service by a Gravity Forms Add-On. The {$SHORT_SLUG} is replaced with the short slug of the add-on you want to modify.

Usage

The action is used by calling the add_filter function and passing it four parameters: the name of the action, your custom function name, priority, and the number of arguments your function accepts. Here’s a generic example:

add_filter( 'gform_helpscout_field_value', 'your_function_name', 10, 4 );

Replace 'your_function_name' with your custom function that modifies the value.

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.

More Information

See Gravity Forms Docs: gform_{$SHORT_SLUG}_field_value
The filter was added in Gravity Forms version 1.9.10.11. The source code is located in GFAddOn::maybe_override_field_value() in includes/addon/class-gf-addon.php.

Examples

Use Choice Text Instead of Value with ActiveCampaign

This example replaces the value of a choice-based survey field with the choice text.

add_filter( 'gform_activecampaign_field_value', 'gf_get_choice_text', 10, 4 );
function gf_get_choice_text( $value, $form, $entry, $field_id ) {
    // your custom code here
    return $value;
}

Replace Commas with Pipes in ActiveCampaign

This example replaces the commas used to separate checkbox or multi select choices with pipe characters.

add_filter( 'gform_activecampaign_field_value', 'gf_replace_commas_with_pipes', 10, 4 );
function gf_replace_commas_with_pipes( $value, $form, $entry, $field_id ) {
    // your custom code here
    return $value;
}

Format Checkbox Field for Emma

This example reformats the checkbox field value to be passed as an array instead of a string.

add_filter( 'gform_emma_field_value', 'gf_format_checkbox_field', 10, 4 );
function gf_format_checkbox_field( $value, $form, $entry, $field_id ) {
    // your custom code here
    return $value;
}

Change Value of Specific Field for Help Scout

This example changes the value of field 3 on form 10 before it is passed to Help Scout.

add_filter( 'gform_helpscout_field_value_10_3', 'gf_change_specific_field_value', 10, 4 );
function gf_change_specific_field_value( $value, $form, $entry, $field_id ) {
    // your custom code here
    return $value;
}

Format Date Field for Zoho CRM

This example reformats the entry date from yyyy-mm-dd to the format configured on the field.

add_filter( 'gform_zohocrm_field_value', 'gf_format_date_field', 10, 4 );
function gf_format_date_field( $value, $form, $entry, $field_id ) {
    // your custom code here
    return $value;
}