Get Field Value from Last Gravity Form Submission

This is a little snippet that I put together for a client who wanted to do something with the previous form entry. I believe it was a field that was set dynamically, and the end-client wanted to either auto-increment, or make sure it was greater than the previous submission.

//Form ID
$form_id = 1;

//Field ID
$field_id = 1;

//Pulls only the most recent entry
$paging = array( 'offset' => 0, 'page_size' => 1 );
$entries = GFAPI::get_entries( $form_id, array(), null, $paging );

//Value that we want
$value = $entries[0][$field_id];

Leave a Reply

Your email address will not be published. Required fields are marked *