gform_partialentries_post_EVENT

Description

Perform a custom action when the partial entry has been saved or updated.

Usage

Entry Saved

The following would run for all forms with the partial entries feature enabled when the entry_saved event occurs.

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

Entry Updated

The following would run for all forms with the partial entries feature enabled when the entry_updated event occurs.

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

Parameters

Examples

1. Trigger Mailchimp Feeds

This example shows how you can send new partial entries to Mailchimp.

add_action( 'gform_partialentries_post_entry_saved', 'send_to_mailchimp_on_partial_entry_saved', 10, 2 );
function send_to_mailchimp_on_partial_entry_saved( $partial_entry, $form ) {
	if ( function_exists( 'gf_mailchimp' ) ) {
		$partial_entry['status'] = 'partial';
		gf_mailchimp()->maybe_process_feed( $partial_entry, $form );
		gf_feed_processor()->save()->dispatch();
	}
}

2. Trigger Webhooks Feeds

This example shows how you can trigger Webhooks feeds for partial entries saved.

add_action( 'gform_partialentries_post_entry_saved', 'webhooks_on_partial_entry_saved', 10, 2 );
function webhooks_on_partial_entry_saved( $partial_entry, $form ) {
	if ( function_exists( 'gf_webhooks' ) ) {
		gf_webhooks()->maybe_process_feed( $partial_entry, $form );
		gf_feed_processor()->save()->dispatch();
	}
}

3. Trigger Zapier Feeds

This example shows how you can send new partial entries to Zapier.

add_action( 'gform_partialentries_post_entry_saved', 'send_to_zapier_on_partial_entry_saved', 10, 2 );
function send_to_zapier_on_partial_entry_saved( $partial_entry, $form ) {
    if ( class_exists( 'GFZapier' ) ) {
        GFZapier::send_form_data_to_zapier( $partial_entry, $form );
    } elseif ( function_exists( 'gf_zapier' ) ) {
        $partial_entry['status'] = 'partial';
        gf_zapier()->maybe_process_feed( $partial_entry, $form );
        gf_feed_processor()->save()->dispatch();
    }
}

4. Trigger HubSpot Feeds

This example shows how you can trigger HubSpot feeds for partial entries saved.

add_action( 'gform_partialentries_post_entry_saved', 'send_to_hubspot_on_partial_entry_saved', 10, 2 );
function send_to_hubspot_on_partial_entry_saved( $partial_entry, $form ) {
	GFCommon::log_debug( __METHOD__ . '(): running.' );
	if ( function_exists( 'gf_hspot' ) ) {
		$partial_entry['status'] = 'partial';
		GFCommon::log_debug( __METHOD__ . '(): trigger Hubspot for Partial Entry: ' . print_r( $partial_entry, true ) );
		gf_hspot()->maybe_process_feed( $partial_entry, $form );
		gf_feed_processor()->save()->dispatch();
	}
}

Since

This hook was added in version 1.0-beta-2.3.

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

This action hook is located in GF_Partial_Entries::maybe_save_partial_entry() in class-gf-partial-entries.php.