---
title: "Restarting a Gravity Flow workflow after import"
date: 2026-04-23
author: "GravityKit"
link: "https://www.gravitykit.com/docs/gravityimport/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 );

}
```

```
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](https://www.gravitykit.com/docs/gravityview/customizing-your-views/where-to-put-code-samples/).