Get Last entry id [RESOLVED]

Hey there,
Anyone have any thoughts on how to dig up the last entry_id from a certain form? I’m fairly sure I can do it through SQL, but if there is a way through API, then it is a little unclear:

$entries = GFAPI::get_entries(
	$form_id, 
	$search_criteria = array(), 
	$sorting = array(
		'key' => 'date_created',
		'direction' => 'ASC'
	),
	$paging = array(
		'offset' => 0, 
		'page_size' => 100
	), 
	$total_count = null
	
);

Thoughts?

Never mind, set it to:

	$entries = GFAPI::get_entries(
	$form_id, 
	$search_criteria = array(), 
	$sorting = array(
		'key' => 'date_created',
		'direction' => 'DESC'
	),
	$paging = array(
		'offset' => 0,
		'page_size' => 1
	), 
	$total_count = null
	
);

And it seems to be okay.

1 Like