Save confirmation name in entry when triggered as conditional logic [RESOLVED]


I have a form with 10 fields.
I have different confirmations with conditional logic based on the value of the fields.
Everything’s working well.

I’d like to store in the database what confirmation has been triggered for every entry.

For example :
Entry 1 has trigerred confirmation 5 (C5).
Entry 2 has trigerred confirmation 9 (C9).

Is there a way to do that ?


Hello Yoann. It would require a bit of code but it should be possible. You would need to run some code when a specific confirmation is processed, and then you could add a note to the entry using the GFAPI that adds the confirmation name there.

Here is the GFAPI documentation for adding a note:

Do you know what type of confirmations these will be? Are they always text or redirect confirmations, or might they vary? I’m trying to find a filter you can use to get the information you need, and the type of confirmation matters. If you can provide that, I will keep looking. Thank you.

Hi Chris,

Thanks for your support.

The confirmations are always “type”:“page”.
Having the page label for the entry would be perfect.
Can the page label be stored in the entry in a field “confirmation” ?

Hi Yoann. You can store the URL that was used for the confirmation redirect in a field in the entry using this code:

// apply to form 63 only
add_filter( 'gform_confirmation_63', function ( $confirmation, $form, $entry ) {
    GFCommon::log_debug( __METHOD__ . '(): My Confirmation => ' . print_r( $confirmation, true ) );
	// ID of the field where you want to store the confirmation that was used
	$field_id = 6;
	$result = GFAPI::update_entry_field( rgar( $entry, 'id' ), $field_id, $confirmation['redirect'] );
	GFCommon::log_debug( __METHOD__ . '(): Result of updating entry with confirmation => ' . print_r( $result, true ) );
    return $confirmation;
}, 11, 3 );

The form ID will need to be updated from 63 to whatever the form ID is on your site. And then $field_id will need to be changed from 6 to whatever the ID of the field where you want to store the confirmation URL in your entry is.

If you have any other questions, please let us know.

Hi Chris,

Thank you, this is perfect.

Best regards

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.