Getting entry fields from gravity form

Hi Jerry. gform_after_submission can be applied to all forms or individual forms. When you apply it to an individual form like this:

add_action( 'gform_after_submission_93', 'send_to_api', 10, 2 );

That means when form 93 is submitted, this hooks runs, and you have an $entry you can access, like this:

add_action( 'gform_after_submission_93', 'send_to_api', 10, 2 );
function send_to_api( $entry, $form ) {
	// take what was submitted in field 21 of the entry and
	// assign it to $some_variable
	$some_variable = rgar ( $entry, '21' );
	// do something with that variable
}

I used the helper function rgar to access to $entry:

Does that make sense? Because gform_after_submission runs after every form submission (of submissions for a specific form if you limit it like I did) you will have a single $entry where you can find all the information that was submitted in the form.

Let me know if you have any other questions.

2 Likes