GravityView: How to trigger feeds after editing an entry

The code snippets below don't trigger form notifications when editing an entry. We have a different solution for that by using GravityRevisions.

To trigger or restart a Gravity Flow Workflow, please check this other article instead.

To trigger a Gravity Forms add-on feed when editing an entry with GravityEdit (formerly called Inline Edit), please check this article instead.

When you edit an entry with GravityView, you might want to re-process the add-on feeds that the form has. This is useful for re-sending emails or sending updated entry data to services such as Zapier. For that to happen, it's necessary to add a bit of code to your theme, so after submitting the changes, GravityView tells Gravity Forms to process its feeds again.

Before you use this code:

  • If you are not sure how to add custom code to your theme, please take a look at this article.
  • The code samples below target specific forms by their ID. In those examples, it's the ID 100. Please make sure to change that to the specific form ID connected to your View.

Trigger all feeds from a specific form

add_action( 'gravityview/edit_entry/after_update', 'gravityview_trigger_feeds', 10, 3 );

function gravityview_trigger_feeds( $form, $entry_id, $object = null ) {

	if ( 100 !== (int) $form['id'] ) { // replace 100 with your form ID
		return;
	}

	$object = $object ?: new stdClass();

	add_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );
  
	gf_apply_filters( array( 'gform_entry_post_save', $form['id'] ), $object->entry, $form );
  
	remove_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );
    
}

When using the Zapier Add-On

add_action( 'gravityview/edit_entry/after_update', 'gravityview_trigger_zapier_feed', 10, 3 );

function gravityview_trigger_zapier_feed( $form, $entry_id, $object = null ) {
	
	if ( 100 !== (int) $form['id'] ) { // replace 100 with your form ID
		return;
	}
	
	if( ! class_exists('GF_Zapier') ) {
		return;
	}

	$object = $object ?: new stdClass();

	add_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );

	$Zapier = GF_Zapier::get_instance();
	$Zapier->maybe_process_feed( $object->entry, $form );

	remove_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );
}

When using the WebHooks Add-On

add_action( 'gravityview/edit_entry/after_update', 'gravityview_trigger_webhooks_feed', 10, 3 );

function gravityview_trigger_webhooks_feed( $form, $entry_id, $object = null ) {

	if ( 100 !== (int) $form['id'] ) { // replace 100 with your form ID
		return;
	}
	
	if( ! class_exists('GF_Webhooks') ) {
		return;
	}

	$object = $object ?: new stdClass();

	add_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );

	$GF_Webhooks = GF_Webhooks::get_instance();
	$GF_Webhooks->maybe_process_feed( $object->entry, $form );

	remove_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );
}

When using the Slack Add-On

add_action( 'gravityview/edit_entry/after_update', 'gravityview_trigger_slack_feed', 10, 3 );

function gravityview_trigger_slack_feed( $form, $entry_id, $object = null ) {

	if ( 100 !== (int) $form['id'] ) { // replace 100 with your form ID
		return;
	}
	
	if( ! class_exists('GFSlack') ) {
		return;
	}

	$object = $object ?: new stdClass();

	add_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );

	$Slack = GFSlack::get_instance();
	$Slack->maybe_process_feed( $object->entry, $form );

	remove_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );
}

When using the MailChimp Add-On

add_action( 'gravityview/edit_entry/after_update', 'gravityview_trigger_mailchimp_feed', 1, 3 );

function gravityview_trigger_mailchimp_feed( $form, $entry_id, $object = null ) {
	
	if ( 136 !== (int)$form['id'] ) { // replace 100 with your form ID
		return;
	}
	
	if( ! class_exists('GFMailChimp') ) {
		return;
	}

	$object = $object ?: new stdClass();
	
	$feed = GFAPI::get_feed( 150 ); // replace 150 with your feed ID

	add_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );
	
	$MailChimp = GFMailChimp::get_instance();                                                                                                     
	$MailChimp->process_feed( $feed, $object->entry, $form );
	
	remove_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );
	
}

When using the Zoho CRM Add-On

add_action( 'gravityview/edit_entry/after_update', function ( $form, $entry_id, $object = null ) {
	if ( 100 !== (int) $form['id'] || ! $object ) { // replace 100 with your form ID
		return;
	}
	
	if( ! class_exists('GFZohoCRM') ) {
		return;
	}

	$feed = GFAPI::get_feed( 150 ); // replace 150 with your feed ID

	add_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );

	$ZOHO = GFZohoCRM::get_instance();
	$ZOHO->process_feed( $feed, $object->entry, $form );

	remove_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );
}, 10, 3 );

Priority is set to something unlikely to be used by other codes (1294873). Feel free to use a different priority.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us