Read Customer Stories
Digitization boosts DeRock Electric’s operations, efficiency, and profitability.
Built a a HIPAA-Compliant Start-Up and saved $250k+ saved/year.
Try Interactive Demo
No-code database platforms are transforming the way web apps are…
Template Marketplace
Supercharge your Work Order Management by managing work orders, assigning…
Supercharge your Work Order Management by managing work orders, assigning…

How to Show Records Connected to the Logged-In User

Related Posts

Hey everyone, Daniel from Knack here. Today I want to show you how to connect records to the logged-in user.

We’ll be working out of the CRM Portal app, one of Knack’s template apps available on our website. If you want to explore this template, it’s called Custom CRM. You can view a summary of what the app does and even install it on your own account to test and customize it.

I’ll also reference a Knowledge Base article titled the same—“Show Records Connected to the Logged-In User”—available at learn.knack.com. I’ll include links to both the app and the article with this video.

Why This Is Helpful

When you’re just starting to build your app, you might display all records to all users—like a single page showing every contact. That works fine at first, but as your app grows, you’ll want more control over who sees what.

For example:

  • Let sales reps log in and only see their assigned contacts
  • Improve privacy and security by limiting data visibility
  • Ensure customers only see their own records (e.g., invoices)
  • Let employees view only their assigned jobs

To do that, we need to:

  1. Enable user roles
  2. Connect those users to records

Step 1: Enable User Roles

First, check that user roles are enabled in your app. In this template, they’re already turned on.

If yours are not:

  • Go to the Schema section
  • Or navigate to Settings > User Logins and enable users there

Step 2: Add a Sales Rep User Role

In the Schema:

  • Click Add User Role
  • Name it: Sales Reps

The user role will come with basic fields (name, email, etc.)—those work fine for now.

Step 3: Add User Records

Next, let’s add some sample user records:

  • Click Records (either in the side panel or top nav)
  • Add test users: John Smith and Jane Doe

Step 4: Create a Connection Between Users and Records

Now we’ll connect Contacts to Sales Reps:

  • Go back to the Schema
  • Click on the Contacts object
  • Add a new Connection Field
    • Connect Contacts to Sales Reps
    • Each Contact connects to one Sales Rep
    • Each Sales Rep connects to many Contacts

Move the new field higher in the object so it’s easier to work with.

Step 5: Assign Contacts to Sales Reps

Head to the Records section in the Contacts object.

Manually assign a few contacts to Jane Doe and a few to John Smith.
If you’re working with many records, you can:

  • Use bulk import
  • Use batch updates to assign records more efficiently

Step 6: Create a Login Page for Sales Reps

Now let’s build a login-protected page for Sales Reps to view their assigned contacts.

  • Go to the Pages section
  • Click Add Page > Login Page
  • Restrict access to the Sales Reps role
  • Name the page: My Contacts

Add a Table View:

  • Choose to show Contacts connected to the logged-in Sales Rep
  • Optionally include links to edit or view details
  • Name the view: My Contacts
  • Add the table

Recap: What We Just Did

Let’s walk through the full process again:

  1. Enabled user roles in the app
  2. Created a Sales Rep user role
  3. Added sample user records (John & Jane)
  4. Connected Contacts to Sales Reps via a connection field
  5. Assigned contacts to each sales rep
  6. Created a login-protected page showing only assigned contacts

Testing It in the Live App

Let’s see how it works in the live app:

  • Logged in as John Smith: He sees four contacts assigned to him
  • Logged in as Jane Doe: She sees two contacts
  • The original page still shows all contact records, not filtered by user

Wrap-Up

That’s it! You’ve now created a user-specific view using user roles and connection fields.

If you have any questions, feel free to reach out.
Until next time—happy building!