ENUM Value Type show by User roles

How do you restrict display / visibility of a ENUM values based on user roles?

0 3 350
3 REPLIES 3


@nmehta wrote:

a ENUM values


If you're referring to displaying the value populated in a column, use the column's Show if property. If you're referring to the values that can be selected by a user editing the column's value, use its Valid if property.


@nmehta wrote:

based on user roles


If you're referring to AppSheet's generic user roles, use the USERROLE function. If you've defined custom user roles in your app, use a technique like  Current User (Slice) | How to conform your app a... - Google Cloud Community

To add to @dbaum 's comment...

Try setting below

TeeSee1_0-1669379205599.png

Suggested values

 

IFS(
 USERROLE() = "Admin", {list of values for Admin},
 USERROLE() = "User", {list of values for User}
)

 

This does not stop users from entering non-permitted values directly (Add or New) - suggested values mean just that.

If you want to restrict users to enter only certain values, then you also need to set Valid-If expression similar to above.

However, you cannot use USERROLE() in the expression because it is dynamically evaluated and if a row which was created by someone with an Admin role is opened for edit by someone with a User role, then that row becomes invalid and won't be able to be saved.

In this case, you can create a column that captures the role of the user who created the row and gets updated only when that particular enum field is edited (reset on Edit with a proper condition) . This way you allow changes in fields other than the enum field by users with a different role from the role of the previous user who edited the enum field and also the display of enum values  can be controlled based on the current logon user.

Hope this makes sense...

I found a way from the forum subject "Enum option display based on user setting value"...

and I used below formula after creating a slice for Useremail() = [Useremail] 

If(Any(Current_User [Rights])= "Admin", List("Declined", "Agreed", "Paused"), List("Agreed", "Paused))

So now based on user rights it will display the option based on ENUM value type...

Thanks everyone for your prompt assistance.

Top Labels in this Space