Trigger a form entry deletion upon submission

Is there a way to make a form submission trigger an entry deletion based on Conditional Logic? For example, a form is submitted that has a unique identifier such as an Employee ID Number or phone number.

Later down the line, entries that contain the employee ID number need to be removed. Ideally, we would like to create a form that has a dropdown menu that pulls from the employee id and phone number filed. When they are selected, the form is submitted, and said submission removes the entries.

Please Help!

Conditional logic can’t be used for this. You would need to create your own custom PHP function to get the value selected from the dropdown, search for it and delete entries using the GFAPI class. Once you have your function ready, you can use the gform_after_submission hook to fire it after submission.

Below are the documentation pages related to the above use case:

How to get values from $entry: Entry Object - Gravity Forms Documentation

GFAPI functions that you can use to obtain the list of entries and delete them: GFAPI Class - Gravity Forms Documentation

The hook to use to fire your code: gform_after_submission - Gravity Forms Documentation

1 Like

What would the .php file be named? Would you be kind enough to share an example .php file that demonstrates this? It Would be very helpful as I attempt to replicate it.

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