Displaying Records Shared Within User Groups

Learn how to create views that show records shared within a user's company, division, or other group.

What you'll learn:

  • How to connect users to groups
  • How to set up records shared within groups
  • How to create views that respect group-based access

Overview

This guide demonstrates how to create group-based record sharing in your Knack app. Unlike showing records connected directly to a logged-in user, this approach allows multiple users within the same group (like a company division) to access the same set of shared records.

Note: This article builds on concepts from "Show Records Connected to the Logged-In User." You may want to review that article first if you're unfamiliar with user connections.

Prerequisites

  • Users must be enabled in your app
  • Understanding of table connections
  • Basic knowledge of page creation

Step 1: Creating Tables and Connections

In this example, we'll work with three elements:

  • A Sales Rep user role
  • A Division table
  • A Sales Leads table

Setting Up the Connection Structure

  1. Select the Sales Rep user role table
  2. Click the + button to add a new field
  3. Choose Connection
  4. Select the Division table as the connection target
  5. Choose Connect to one Division (one-to-many relationship)

Next, create a similar connection between Sales Leads and Divisions:

  1. Select the Sales Leads table
  2. Add a Connection field
  3. Connect to the Division table
  4. Choose Connect to one Division (one-to-many relationship)

These connections create a shared relationship where:

  • Each Sales Rep belongs to one Division
  • Each Sales Lead belongs to one Division
  • A Division can have many Sales Reps and many Sales Leads

Step 2: Updating Records

Now assign divisions to your existing records:

  1. Navigate to the Sales Rep user role
  2. Select the Records tab
  3. Edit each record to assign the appropriate Division

Repeat the process for Sales Leads:

  1. Navigate to the Sales Leads table
  2. Select the Records tab
  3. Assign the appropriate Division to each lead

Step 3: Creating Restricted Access Pages

Now create a page that will show only the leads from the user's division:

  1. Go to the Pages section of the Builder
  2. Click the + button to add a new page
  3. Select Login Page
  4. Restrict access to the Sales Rep user role

Step 4: Adding a Filtered View

  1. Add a Table or List view to display Sales Leads
  2. In the Source options, select Sales Leads
  3. Under Filter, choose:
    • Sales Leads ▸ Division
    • is
    • Division connected to the logged-in user

This filter is the key to group-based access. It ensures users only see leads that belong to the same division they're connected to.

Step 5: Testing Your Configuration

  1. Click Go to Live App or the open button in the Builder
  2. Log in as a Sales Rep
  3. Navigate to your new page
  4. Verify that only leads from the user's division are visible

Troubleshooting

Common Issues

  • Too many records showing: Check that your divisions are properly assigned to both users and records
  • No records showing: Verify that the filter is correctly set to "Division connected to the logged-in user"
  • Access problems: Ensure the page is properly restricted to the Sales Rep user role

Adding Views to Existing Pages

If you already have login pages set up:

  1. Navigate to the page in the Builder
  2. Click Add View
  3. Follow the same steps to configure the filtered view

Tip: This same approach can be used for any group-based sharing scenario, such as departments, teams, companies, or locations.