# Quickly Locate Email Rules in Your Knack Application

**URL:** <https://forums.knack.com/t/quickly-locate-email-rules-in-your-knack-application/14883>\
**Category:** Show & Tell\
**Created:** [September 18, 2023, 11:44pm UTC](https://forums.knack.com/t/quickly-locate-email-rules-in-your-knack-application/14883 "2023-09-18T23:44:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kelson](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/kelson/32/762_2.png) [@Kelson](https://forums.knack.com/u/Kelson)\
**Post date:** [September 18, 2023, 11:44pm UTC](https://forums.knack.com/t/quickly-locate-email-rules-in-your-knack-application/14883/1 "2023-09-18T23:44:23Z")

</div>

Hey fellow Knack users!

If you’ve ever needed to find where in a Knack application email rules are set up, you know it can be a daunting task. Especially in larger applications, searching through every form one-by-one is not just tedious, but also a massive time drain. I was unable to find a solution online and decided to write a quick script.

**Introducing a Handy Script to Save Hours**  
Rather than searching manually, I produced this code to get a swift list of all locations where email rules are defined. Here’s the code:

```auto
const buildUrl = (appName, appSlug, sceneKey, viewId) => {
    return `https://builder.knack.com/${appName}/${appSlug}/${sceneKey}/${viewId}`;
};

const hasEmails = view => Boolean(view.attributes?.rules?.emails?.length);

const getEmailUrls = models => {
    const appAttributes = Knack.app.attributes;
    const { name: appName, slug: appSlug } = appAttributes;

    return models.reduce((acc, model) => {
        const foundView = model.views.models.find(hasEmails);
        
        if (foundView) {
            const url = buildUrl(appName, appSlug, foundView.attributes.scene.key, foundView.id);
            acc.push(url);
        }

        return acc;
    }, []);
};

const emails = getEmailUrls(Knack.scenes.models);
console.table(emails);

```

**How to Use This Code:**

1. Navigate to your Knack application’s live site (no need to be logged in).
2. Open the browser’s developer tools and select the console tab.
3. Paste the code above into the console and hit enter on your keyboard.
4. The result will display as a table. Depending on your display settings, you might need to adjust the width of the table to view the full URLs.

Using this, I was able to quickly track down the specific email I was searching for without the manual hassle.

I hope this helps some of you out there looking for a quicker solution!

Cheers and happy coding!

---

<div class="post-metadata">

**Author:** ![Nir](https://avatars.discourse-cdn.com/v4/letter/n/3bc359/32.png) [@Nir](https://forums.knack.com/u/Nir)\
**Post date:** [September 19, 2023, 6:21am UTC](https://forums.knack.com/t/quickly-locate-email-rules-in-your-knack-application/14883/2 "2023-09-19T06:21:15Z")

</div>

Hey Kelson,

Looks nice! A different, more broader view, is available through [https://find.knack.com/definitions.](https://find.knack.com/definitions) Please try this out 🙂

Nir

---

<div class="post-metadata">

**Author:** ![Steven](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@Steven](https://forums.knack.com/u/Steven)\
**Post date:** [September 24, 2023, 11:07pm UTC](https://forums.knack.com/t/quickly-locate-email-rules-in-your-knack-application/14883/3 "2023-09-24T23:07:52Z")

</div>

Hello, I’m interested in seeing this application, when I click the link it just takes me to a screen to log into KNACK. Am I missing something.

Thank you,  
Steve

---

<div class="post-metadata">

**Author:** ![Nir](https://avatars.discourse-cdn.com/v4/letter/n/3bc359/32.png) [@Nir](https://forums.knack.com/u/Nir)\
**Post date:** [September 25, 2023, 3:36pm UTC](https://forums.knack.com/t/quickly-locate-email-rules-in-your-knack-application/14883/4 "2023-09-25T15:36:17Z")

</div>

Hey Steven,

If you dont already have a user, at the bottom of the screen there is a Sign Up button for a free account. Just create a user for yourself and log in. See screen capture attached.

Thanks  
Nir

 ![Screenshot 2023-09-25 at 18.36.45](https://us1.discourse-cdn.com/flex020/uploads/knack/original/2X/4/46a927f7f281a505e85c8968beb58a4ca4608906.png)

---

<div class="post-metadata">

**Author:** ![Steven](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@Steven](https://forums.knack.com/u/Steven)\
**Post date:** [September 25, 2023, 5:52pm UTC](https://forums.knack.com/t/quickly-locate-email-rules-in-your-knack-application/14883/5 "2023-09-25T17:52:39Z")

</div>

Got it, Thank you
