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
- Select the Sales Rep user role table
- Click the + button to add a new field
- Choose Connection
- Select the Division table as the connection target
- Choose Connect to one Division (one-to-many relationship)
Next, create a similar connection between Sales Leads and Divisions:
- Select the Sales Leads table
- Add a Connection field
- Connect to the Division table
- 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:
- Navigate to the Sales Rep user role
- Select the Records tab
- Edit each record to assign the appropriate Division
Repeat the process for Sales Leads:
- Navigate to the Sales Leads table
- Select the Records tab
- 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:
- Go to the Pages section of the Builder
- Click the + button to add a new page
- Select Login Page
- Restrict access to the Sales Rep user role
Step 4: Adding a Filtered View
- Add a Table or List view to display Sales Leads
- In the Source options, select Sales Leads
- 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
- Click Go to Live App or the open button in the Builder
- Log in as a Sales Rep
- Navigate to your new page
- 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:
- Navigate to the page in the Builder
- Click Add View
- 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.
Updated 3 days ago