gravityflowformconnector_target_entry_id

Use this filter to change the target entry of the Form Connector Update Fields Step or Update An Entry Step will attempt to update to/from.

Parameters

$target_entry_id integer
The entry ID step settings identified.

$target_form_id integer
The form for the entry ID identified

$entry array
The current $entry

$form array
The current form

$step object
The current step

Example 1

Locate the entry with the largest value in a separate form numeric field. 

add_filter( 'gravityflowformconnector_target_entry_id', 'search_best_price_entry', 10, 5 );
function search_best_price_entry( $target_entry_id, $target_form_id, $entry, $form, $step ) {
 
	$search_criteria['field_filters']['mode'] = 'all';
	$sorting = array( 'key' => 1, 'direction' => 'DESC', 'is_numeric' => true );
	$paging = array( 'offset' => 0, 'page_size' => 1 );
	$entries = GFAPI::get_entries( 8, $search_criteria, $sorting, $paging );

	if( $entries ) {
		foreach( $entries as $entry ) {
			return $entry['id'];
		}
	}

	return $target_entry_id;
}