Hi community
I am trying to implement dynamic permissions based on user roles using Update Mode in AppSheet. I have a “Persona” table that contains the “Email” and “Permiso” (Permission) columns to manage access levels.
I have tried two different approaches:
- Using SWITCH with LOOKUP:
SWITCH(
LOOKUP(USEREMAIL(), “Persona”, “Email”, “Permiso”),
“Administrador”, “ALL_CHANGES”,
“Actualizador”, “UPDATES_ONLY”,
“READ_ONLY”
)
- Using LOOKUP directly:
LOOKUP(USEREMAIL(),“Persona”,“Email”,“Permiso”)
When trying to edit or update records in the “Cargo” table, I receive the following errors:
With direct LOOKUP:
Unable to update row in table ‘Cargo’. → Table ‘Cargo’ does not allow this operation.
Expression result: ‘’.
Expression Trace: {
“key”: “ANY(SELECT(Persona[Permiso],([Email] = USEREMAIL())))”,
“result”: “”,
“values”: [{
“key”: “SELECT(Persona[Permiso],([Email] = USEREMAIL()))”,
“result”: “”,
“values”:
}]
}
With SWITCH:
Unable to update row in table ‘Cargo’. → Table ‘Cargo’ does not allow this operation.
Expression result: ‘READ_ONLY’.
Expression Trace: {
“key”: “SWITCH(ANY(SELECT(Persona[Permiso],([Email] = USEREMAIL()))),"Administrador","ALL_CHANGES","UPDATES_ONLY","UPDATES_ONLY","READ_ONLY")”,
“result”: “READ_ONLY”,
“values”:
}
Specific questions:
- Why is SELECT/LOOKUP returning an empty result when trying to get user permission?
- Is there any limitation in AppSheet that restricts the use of LOOKUP/SWITCH in Update Mode?
- Can we only use expressions like USEREMAIL() or USERSETTINGS()?
- Is there anything in the data structure or expression that I should review?
Additional information:
- Main table: Cargo
- Permissions table: Persona (with Email and Permiso columns)
- Possible values in Permiso column: “Administrador” (Administrator), “Actualizador” (Updater)
- The user’s email is correctly configured in the Persona table
Any guidance to solve this issue would be greatly appreciated.