GravityView Integration

GravityView is an extremely powerful add-on for Gravity Forms which allows you to display and edit entries on the front-end of your site. It can be used to create lists of workflow entries and display their final status and current workflow step.

It can also be used to create custom, form-specific, workflow inboxes. This gives you a lot of flexibility over the columns in the table, and it also enables you to create inboxes for groups of assignees or create special inboxes with advanced filters.

The following screenshot shows an inbox displaying tasks for the current user along with entry values, the final status, the current workflow step, and a link to the workflow entry detail page. It functions just like the built-in Gravity Flow inbox, except you get all the extra functionality that comes with GravityView such as paging, sorting, caching, custom content templates etc.

The Final Status, Workflow step and Workflow detail link columns are added to the view just like any other field:

Of course you can customise the link text in the field settings:

By default, the view will display all entries. However, if you want to filter the entries to display only the entries assigned to the current user you'll need to add a filter. Please note that this does require the GravityView Advanced Filter Extension.

In addition to "Current User", the Workflow Assignee values include all the assignees for the current form from all the steps, so you can create group inboxes which display with entries for more than one assignee.

Note:

Edits and Approvals done through 'GravityView' are completely independent of 'Gravity Flow' and will not trigger workflow steps.

That being said, Gravity View and Flow are both very extensible plugins so with a small amount of custom code it would be possible to do so. The following snippet shows how to a user completing a Gravity View edit can check whether the edited entry was also at a Gravity Flow User Input step where they were an assignee. If they were, it will mark their assignee action complete. If appropriate (that assignee was the final required for the step) it will lead to the workflow proceeding to next step.

// The following marks user input steps as complete when they are submitted in GravityView.
add_action( 'gravityview/edit_entry/after_update', 'gravityview_update_flow', 10, 3 );

function gravityview_update_flow ( $form = array(), $entry_id = array(), $object ) {

	// replace 61 with your form ID or an in_array check if doing multiple forms.
	if ( 61 !== (int) $form['id'] ) {
		return;
	}

	add_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );
	$form_id  = RGFormsModel::get_lead( $_REQUEST['gform_submit'] );
	$entry_id = $_REQUEST['lid'];
	$entry    = RGFormsModel::get_lead( $_REQUEST['lid'] );
	$api      = new Gravity_Flow_API( $form_id );
	$status   = $api->get_status( $entry );
	$step     = $api->get_current_step( $entry );

	//Modify to include the list of User Input steps which are appropriate to have a View Edit action attempt to trigger the user input assignee activity.
	$included_steps = array (405, 481, 488);
	
	if ( in_array( $step->get_id(), $included_steps )) {
		$previous_assignees = $step && $step instanceof Gravity_Flow_Step ? $step->get_assignees() : array();
		$previous_data = [];
		foreach ( $previous_assignees as $assignee ) {
			if ( $assignee->is_current_user() ) {
				$success = $assignee->process_status( 'complete' );
			}
		}
		$step->refresh_entry();
	}
	remove_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );
}