Set visibility of button with expression

Hi, I want to show the delete or edit button only to the owner of the object, or to the administrator role. Checking the owner in visibility works fine, but I keep struggling with checking of the user has the administrator role. I see all kins of suggestions from the (very)past, but think that nowadays that should be similar to checking the owner. Can this be done in Visibility? Has someone an example, it might be that I still do not understand the expression syntax. so I need something like in plain text ‘or current user has Administrator role’.  If I Add or conditions to the expression below I get ‘no viable alternative at input ‘System.owner’.  
3 answers

Hi Peter,


If you give condition like the above picture, for admin it won’t work. 

When you login as admin , it will check whether current object owner is current user or not [Now current user is admin obviously admin will not be owner for that object] . 


So, to make that button visible for both owner and admin. Create two buttons-  add condition visibility for owner in one button  and select the module role admin for other button.




In addition to above:

with user demo_user or demo_super user: than button A is shown ONLY of they are the owner (so that's ok)

with user demo_administrator : button B is shown in case the object owner is demo_superuser or demo_user (so that’s ok)

with user demo_administrator : button A and B is shown in case the object owner is demo_administrator (so that’s NOT ok) 
only 1 button is what I want.


A bit late,,,

What you suggested works fine Steffy.


Kind Regards