Using Gravity Forms ‘gform_after_update_entry’ PHP action

The gform_after_update_entry action in Gravity Forms fires after an entry has been updated via the entry detail page.

Usage

add_action('gform_after_update_entry', 'your_function_name', 10, 2);

Parameters

  • $form (Form Object) – The form object for the entry.
  • $entry_id (integer) – The entry ID.

More information

See Gravity Forms Docs: gform_after_update_entry

Examples

Update entry properties

This example sets the entry as unread and stars it.

add_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);
}

Log the entry before and after update

add_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));
}

Trigger Zapier Feed

This example sends the updated entry to Zapier.

add_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);
    }
}

Trigger Mailchimp Feed

This example sends the updated entry to Mailchimp.

add_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);
    }
}

Trigger Webhooks Feed

This example triggers processing of Webhooks feeds which use the background (async) processing feature.

add_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);

Add note

This example adds a note to the entry.

add_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