DescriptionUsageParametersExamples1. Update entry properties.2. Log the entry before and after update.3. Trigger Zapier Feed4. Trigger Mailchimp Feed5. Trigger Webhooks Feed6. Add notePlacementSource Code
Description
This hook fires after the entry has been updated via the entry detail page.
Usage
The following would run for any form:
1add_action( 'gform_after_update_entry', 'your_function_name', 10, 2 );
To target a specific form append the form id to the hook name. (format: gform_after_update_entry_FORMID)
1add_action( 'gform_after_update_entry_10', 'your_function_name', 10, 2 );
Parameters
$form Form Object
The form object for the entry.
$entry_id integer
The entry ID.
$original_entry Entry Object
The entry before being updated. Since 1.9.12.9.
Examples
1. Update entry properties.
This example sets the entry as unread and stars it.
12345add_action( 'gform_after_update_entry', 'update_entry', 10, 2 );function update_entry( $form, $entry_id ) { GFAPI::update_entry_property( $entry_id, 'is_read', 0 ); GFAPI::update_entry_property( $entry_id, 'is_starred', 1 );}
2. Log the entry before and after update.
123456add_action( 'gform_after_update_entry', 'log_post_update_entry', 10, 3 );function log_post_update_entry( $form, $entry_id, $original_entry ) { $entry = GFAPI::get_entry( $entry_id ); GFCommon::log_debug( 'gform_after_update_entry: original_entry => ' . print_r( $original_entry, 1 ) ); GFCommon::log_debug( 'gform_after_update_entry: updated entry => ' . print_r( $entry, 1 ) );}
3. Trigger Zapier Feed
This example shows how you can send the updated entry to Zapier.
123456789add_action( 'gform_after_update_entry', 'send_to_zapier_on_update', 10, 2 );function send_to_zapier_on_update( $form, $entry_id ) { $entry = GFAPI::get_entry( $entry_id ); if ( class_exists( 'GFZapier' ) ) { GFZapier::send_form_data_to_zapier( $entry, $form ); } elseif ( function_exists( 'gf_zapier' ) ) { gf_zapier()->maybe_process_feed( $entry, $form ); }}
4. Trigger Mailchimp Feed
This example shows how you can send the updated entry to Mailchimp.
1234567add_action( 'gform_after_update_entry', 'send_to_mailchimp_on_update', 10, 2 );function send_to_mailchimp_on_update( $form, $entry_id ) { if ( function_exists( 'gf_mailchimp' ) ) { $entry = GFAPI::get_entry( $entry_id ); gf_mailchimp()->maybe_process_feed( $entry, $form ); }}
You can use this same snippet for other similar add-ons like Zoho CRM, AgileCRM, ActiveCampaign, etc… Replacing gf_mailchimp above by the corresponding add-on function name, like gf_zohocrm, gf_agilecrm, gf_activecampaign, etc…
5. Trigger Webhooks Feed
This example shows how you can trigger processing of Webhooks feeds which use the background (async) processing feature.
1234567add_action( 'gform_after_update_entry', function ( $form, $entry_id ) { if ( function_exists( 'gf_webhooks' ) ) { $entry = GFAPI::get_entry( $entry_id ); gf_webhooks()->maybe_process_feed( $entry, $form ); gf_feed_processor()->save()->dispatch(); }}, 10, 2 );
6. Add note
This example shows how you can add a note to the entry.
1234add_action( 'gform_after_update_entry', function ( $form, $entry_id ) { $current_user = wp_get_current_user(); RGFormsModel::add_note( $entry_id, $current_user->ID, $current_user->display_name, 'the note to be added' );}, 10, 2 );
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFEntryDetail::lead_detail_page() in entry_detail.php.