Problem with Editable_If (USERROLE() = "admin" not working)

Hello All,
I have "Projects" table (allowed: UPDATES, ADDS) and slice (allowed: UPDATES, ADDS).
Inside "Projects" there is field called "name" (type TEXT, KEY = N, LABEL = N, REQUIRE = Y, SHOW = Y).
Field "name" must be UNIQUE so in Valid_If I have:

ISBLANK(FILTER("Projects", AND(([_ROWNUMBER] <> [_THISROW].[_ROWNUMBER]), ([name] = [_THIS]))))

And I would like that "name" field:
- Can be provided (when creating a record) by anyone
- Can only be changed later by ADMINS

So, in Editable_If I have:

OR(ISBLANK([_THIS]), USERROLE() = "admin")

It was working (edition rules) but ... some time ago stopped 😞
Nobody is able to edit that field 😞
When I test Editable_If expression I have Y for all records.
When I put inside Editable_If just "true" I can edit.
Of course I am admin, I checked it 🙂

Can you suggest what else I can check to understand why it stopped working ?
I got lost.

Thanks in advance.
Łukasz

Solved Solved
0 19 334
1 ACCEPTED SOLUTION

The TRUE will work as it will always give the result as TRUE with all rows and it doesn't matter who the user is. Are you sure you are using the app with the correct email address? Please check the email from the upper left menu.

View solution in original post

19 REPLIES 19

I made a quick test and when using USERROLE()="Admin" or the opposite USERROLE()<>"Admin" with the Editable_If they both work just fine. Meaning.. the reason is probably coming from somewhere else.

Btw.. in generally it would be better to use below approach when adding the new record. If the user makes mistake when filling the field, he/she would be still able to modify it before the record is saved.

OR(
NOT(IN([KeyColumn],TableName[KeyColumn])),
USERROLE()="Admin"
)

Hello Aleksi,
May thanks for idea: "NOT(IN([KeyColumn], TableName[KeyColumn]))".
As concern 'USERROLE()="Admin"', it is working for me in other apps but not in this particular one.
That's why I decided to describe it so detailed and ask community for help.
Maybe there is "something else" to check ... I have no idea 😞

Do they have the same structure exactly?

Structure ... probably not 100% identical in all my apps.
But, for expression:
   OR(ISBLANK([_THIS]), USERROLE() = "Admin")
which element of structure makes matter?
Anyway, good idea, I will try to play a little with it.
I will give know if I find something.

The most strange is:
- When I put expression just "true" I can edit field.
- When I put expression 'USERROLE() = "Admin"' and I test it I have "Y" for all records (because I have Admin role) but I can not edit 😞

The TRUE will work as it will always give the result as TRUE with all rows and it doesn't matter who the user is. Are you sure you are using the app with the correct email address? Please check the email from the upper left menu.

Of course I am sure that I have Admin role 🙂
I was surprised that 'USERROLE() = "Admin"' is not working so I have added Virtual Column with expression "USERROLE()" and show it in form.
Result: "Admin".
It was exactly that moment when I realized ... I have no idea 🙂

I'm not saying you are not set as admin. I'm wondering if the app/device is not connected to a correct email address. That you can verify from the upper left corner (upper menu).

Clear 🙂
Email is correct.

And not using alias email addresses?

No alias.
Just to be sure I removed all cookies and log in again with proper email.
And behavior is the same ... no possibility to edit.

What happens if you change the Editable_If to OR(ISBLANK([_THIS]),USEREMAIL()="YourAdminEmailAddress")?

I made a small app exactly with the same definitions, table/column names etc. and the app works just fine. 

It is the same for me in other apps.
That's why I wrote "I have no idea" 😞

What AppSheet subscription are you using with this app?

I have never think about it 🙂
I received access and start using it 🙂

But, when I check account settings I have "Plan: Core (Google Workspace)".
I hope it is what you are asking for.

Then.. that is not the reason either. Without direct access to your app to debug, unfortunately I don't have any other idea what the reason could be.

Hello Aleksi,
Your suggestion was good 🙂
Everybody with "admin" role can edit, except me 😞 (owner of app)
But ...
- My login used in app via browser is identical with that one used in "Share App" configuration.
- I have no alias for my login.
Anyway, 'USERROLE()="admin"' mechanism is working in my app 🙂
I have to investigate "what is wrong with my login".
Thanks a lot.

Good to hear you were able to at least identify where its coming from 🙂

Top Labels in this Space