Hello AppSheet Community,
I’m working on a security model for a multi-franchise app and have run into a persistent issue that seems like a platform bug, and I’m hoping someone has seen this before.
The Goal: Filter all data (Locations, Associates, etc.) based on the franchise groups a user belongs to. The model needs to support a “Super User” role that can see all data, while regular users see a filtered view. The app is on a Core plan and has been deployed.
The Data Structure:
-
Associates(Key:[Row ID], has[Email],[Franchisor](Yes/No), and[Super User](Yes/No) columns) -
Franchise Groups(Key:[Row ID]) -
Associate Franchise Groups(Join table withRefs toAssociatesandFranchise Groups) -
All tables are in the native AppSheet Database.
The Logic: The entire model is based on a single USERSETTINGS formula that calculates a user’s allowed list of franchise groups.
-
User Setting Name:
UserFranchiseGroups -
App Formula:
IF( OR( USEREMAIL() = "my_super_user_email@example.com", AND( LOOKUP(USEREMAIL(), "Associates", "Email", "Franchisor"), LOOKUP(USEREMAIL(), "Associates", "Email", "Super User") ) ), Franchise Groups[Row ID], SELECT( Associate Franchise Groups[Franchise Group Id], [Associate Id].[Email] = USEREMAIL() ) )
The Security Filter on the Franchise Groups table is then a simple check against this setting:
IN([Row ID], USERSETTINGS("UserFranchiseGroups"))
The Problem: When this model is active, all filtered views show no data for all users, including the hardcoded super user. This indicates that the USERSETTINGS("UserFranchiseGroups") formula is returning an empty list.
Troubleshooting Steps Taken: We have verified the following:
-
All table structures, keys,
Refcolumns, and column names are correct. -
Data exists for the test users and in the
Franchise Groupstable. -
We used a debug view (and a virtual column) to isolate the
USERSETTINGSformula’s output.
This is the key finding: When we simplify the USERSETTINGS formula to only Franchise Groups[Row ID], it still returns an empty list. This happens even though the Franchise Groups table has data and [Row ID] is correctly set as its key.
We have tried regenerating the structure for all relevant tables multiple times, which has not solved the issue.
My Question for the Community: Why would a simple expression like Franchise Groups[Row ID] fail to return a list of keys when used inside a USERSETTINGS formula? Has anyone encountered a bug where a USERSETTINGS formula seems unable to read data from a specific AppSheet Database table?
Thanks in advance for any insights!