Quickly Locate Email Rules in Your Knack Application

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:

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);

        return acc;
    }, []);

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

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!


Hey Kelson,

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


1 Like

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,

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.


Got it, Thank you