Error in Update Mode using LOOKUP/SELECT for user role-based permissions

Hi community :waving_hand:t2:
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:

  1. Using SWITCH with LOOKUP:

SWITCH(
LOOKUP(USEREMAIL(), “Persona”, “Email”, “Permiso”),
“Administrador”, “ALL_CHANGES”,
“Actualizador”, “UPDATES_ONLY”,
“READ_ONLY”
)

  1. 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:

  1. Why is SELECT/LOOKUP returning an empty result when trying to get user permission?
  2. Is there any limitation in AppSheet that restricts the use of LOOKUP/SWITCH in Update Mode?
  3. Can we only use expressions like USEREMAIL() or USERSETTINGS()?
  4. 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.

Please post screenshots of the Are updates allowed? expression and the error message.