# Block access to a form if a specific entry exists

**URL:** <https://community.gravityforms.com/t/block-access-to-a-form-if-a-specific-entry-exists/13514>\
**Category:** Get Help\
**Tags:** custom, no-duplicates, gform\_get\_form\_filter, populate-anything, utm\_key\
**Created:** [September 28, 2022, 8:13pm UTC](https://community.gravityforms.com/t/block-access-to-a-form-if-a-specific-entry-exists/13514 "2022-09-28T20:13:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![user6080194dcd058826](https://avatars.discourse-cdn.com/v4/letter/u/f1d935/32.png) [@user6080194dcd058826](https://community.gravityforms.com/u/user6080194dcd058826)\
**Post date:** [September 28, 2022, 8:13pm UTC](https://community.gravityforms.com/t/block-access-to-a-form-if-a-specific-entry-exists/13514/1 "2022-09-28T20:13:03Z")

</div>

Hello,

I created a multi-step form with a hidden “utm\_key” field in the first step.  
To get people to enter my form, I send them an email with a custom link with a “utm\_key” parameter in the URL.

I would like to deny access to the form to all people who have already answered the form by checking if the utm\_key already exists in the answers of the form in question.  
Not during submission. Really at the very beginning of the form, when the person arrives at the form URL with the “utm\_key” parameter filled in.

If utm\_key already exists in the form inputs, then I display a text that says: “You cannot refill this form…”  
If utm\_key does not exist in the form inputs, then the person has access to the form.

Someone help me find out how to do it?

Thanks

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [September 28, 2022, 8:31pm UTC](https://community.gravityforms.com/t/block-access-to-a-form-if-a-specific-entry-exists/13514/2 "2022-09-28T20:31:20Z")

</div>

Can you enable the ‘no duplicates’ setting for the field that stores the ‘utm\_key’? That would prevent them from being able to submit the form more than one time with that key.

---

<div class="post-metadata">

**Author:** ![user6080194dcd058826](https://avatars.discourse-cdn.com/v4/letter/u/f1d935/32.png) [@user6080194dcd058826](https://community.gravityforms.com/u/user6080194dcd058826)\
**Post date:** [September 28, 2022, 8:54pm UTC](https://community.gravityforms.com/t/block-access-to-a-form-if-a-specific-entry-exists/13514/3 "2022-09-28T20:54:16Z")

</div>

Hello and thanks for your reply  
It’s not possible to enable the ‘no duplicates’ because it’s hidden field  
I really want to block access to the form before starting, not at the end, because the form is very long with multi steps

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [October 3, 2022, 3:45am UTC](https://community.gravityforms.com/t/block-access-to-a-form-if-a-specific-entry-exists/13514/4 "2022-10-03T03:45:48Z")

</div>

Hi Jonathan. In that case, you will need another approach. You will need to use some custom code to check to see if the entry exists before you display the form, and then display a message rather than the form.

To prevent the form from showing, you can use the `gform_get_form_filter`:

> **[gform\_get\_form\_filter](https://docs.gravityforms.com/gform_get_form_filter/)**
>
> This filter allows you to override the form's HTML after it has been generated but before it has been displayed.

If you need to check to see if a specific utm\_key was submitted in a previous entry, you can use the `GFAPI::get_entries` function:

> **[Searching and Getting Entries with the GFAPI](https://docs.gravityforms.com/searching-and-getting-entries-with-the-gfapi/)**
>
> The GFAPI::entry\_exists(), GFAPI::get\_entry(), GFAPI::get\_entries(), GFAPI::get\_entry\_ids(), and GFAPI::count\_entries() methods are used to search, count, get, and check if entries exist.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/f/fef63f0599c45e0218c30d9f5d7ca8bff9b00189.png) [@system](https://community.gravityforms.com/u/system)\
**Post date:** [November 2, 2022, 3:46am UTC](https://community.gravityforms.com/t/block-access-to-a-form-if-a-specific-entry-exists/13514/5 "2022-11-02T03:46:45Z")

</div>

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