Hello everyone. Today I want to consult about how I can create a formula to allow the modification of the tables according to the user's role.
I would not like it to be universal but rather that the user type Admin, modify and add but the User cannot do more than what I allow.
I know what is done from the "Table" section but I don't know how to apply the formula.
IF(USERROLE()="Admin",AND("Updates","Add","Delete","Read-Only"),"Updates")
This is something untested. But well I expose what I wanted to do.
Greetings Thank you.
Solved! Go to Solution.
The issue in your expression is how you're using the AND function. That function returns a true/false value--not a list of values. Regardless, in this case, you need to return only a single value.
See, for example, the following sample expression from the USERROLE help article:
IF((USERROLE() = "Admin"), "ALL_CHANGES", "UPDATES_ONLY")
You can reference the list of valid permission enum values when you open the expression editor for a table's Are updates allowed? property:
The easiest way if your app requires user sign-in (Security > Require Sign-In > Require user signin? = ON) and you know who is who (from each user's email), then use something like the following expression in table's "Are updates allowed?" entry.
SWITCH(USEREMAIL(),
"you@gmail.com", "ALL_CHANGES",
"admin@gmail.com", "ALL_CHANGES",
"operator1@gmail.com", "UPDATES_ONLY",
"operator2@gmail.com", "ADDS_ONLY",
"operator3@gmail.com", "ADDS_AND_UPDATES",
"operator4@gmail.com", "DELETES_ONLY",
"operator5@gmail.com", "UPDATES_AND_DELETES",
"operator6@gmail.com", "ADDS_AND_DELETES",
"READ_ONLY"
)
The issue in your expression is how you're using the AND function. That function returns a true/false value--not a list of values. Regardless, in this case, you need to return only a single value.
See, for example, the following sample expression from the USERROLE help article:
IF((USERROLE() = "Admin"), "ALL_CHANGES", "UPDATES_ONLY")
You can reference the list of valid permission enum values when you open the expression editor for a table's Are updates allowed? property:
Thank you very much @dbaum have a good day!
User | Count |
---|---|
44 | |
31 | |
29 | |
14 | |
14 |