Restarting a Gravity Flow workflow after editing an entry in GravityView
The code sample below targets specific forms by their IDs. Make sure to change those to the specific form ID connected to your View.
The code below restarts a Gravity Flow workflow after editing an entry in GravityView's Edit Entry page.
add_action('gravityview/edit_entry/after_update', function ( $form = array(), $entry_id = array(), $object ) { //The IDs of the Forms you'd like to affect. To target more forms, use [36,81,12] as an example $run_on_forms = [36]; if(!in_array($form['id'], $run_on_forms)){ return; } if( ! class_exists('Gravity_Flow_API') ) { return; } add_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 ); $api = new Gravity_Flow_API( $form['id'] ); $api->restart_workflow( $object->entry ); remove_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 ); }, 10, 3 );
This code doesn't work when editing entries with GravityEdit (formerly known as Inline Edit). We have another code snippet for that.
If you are not sure how to add custom code to your theme, please take a look at this article.