Restarting a Gravity Flow workflow after import

The code below restarts a Gravity Flow workflow after each row of a CSV file has been imported into a form as a new entry with GravityImport.

add_action( 'gravityview/import/entry/created', 'gravityimport_after_entry_created', 10, 2 );
function gravityimport_after_entry_created ( $entry, $batch ){
	
	if( ! class_exists( 'Gravity_Flow_API' ) ) {
		return;
	}
	
	$form_id = $entry['form_id'];	
	$api = new Gravity_Flow_API( $form_id );
	$api->restart_workflow( $entry );

}

If you are not sure how to add custom code to your theme, please take a look at this article

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