Using Gravity Forms ‘gform_entry_created’ PHP action

The gform_entry_created action is a Gravity Forms action that fires after an entry has been created but before the post has been created, notifications have been sent, and the confirmation has been processed.

Usage

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

Parameters

  • $entry (Entry Object) – The entry that was just created.
  • $form (Form Object) – The current form.

More information

See Gravity Forms Docs: gform_entry_created

Examples

Add a value to the entry meta

This example shows how to use the gform_entry_created hook to populate a value in the entry’s entry meta.

add_action('gform_entry_created', 'generate_mergedoc');

function generate_mergedoc($entry, $form) {
    $feed = self::get_mergedoc_feeds($form['id']);

    if (empty($feed) || !rgar($feed, 'active') || !$entry)
        return;

    // Get download link
    $download_link = self::get_download_link($uid);

    // Update entry meta
    gform_update_meta($entry['id'], 'gfmergedoc_download_link', $download_link);
}

Delete an entry property

This example demonstrates how to delete an entry property, such as the user agent, from the database.

add_action('gform_entry_created', function($entry) {
    GFAPI::update_entry_property($entry['id'], 'user_agent', '');
});