Showing App Views as per Roles

Hi All,

Is there a way we can show app views to users based on their roles. I have two tables namely Roles and User Roles.
Roles table has two columns (Role Id and Role Name)
User Roles has (User Id , Name , Email , Role Id(ref from Roles) as columns.

Can you advise expression I can use to filter the app views based on the User Roles Table.

Many Thanks

1 Like

Hi Steve,

Thanks for sharing the links but unfortunately I am still struggling to get it done. I tried to put an expression in the security filter “SHOW_IF” but it didn’t work.

FILTER(  "User Roles",  AND(    ([Role Id] = "1"),    ([Email Id] = USEREMAIL())  ))

Can you advise what I am doing wrong in the above expression?

Many Thanks

The Show? expression must produce a Yes/No result, but your expression produces a List result. The expression you’re using:

FILTER(
  "User Roles",
  AND(
    ([Role Id] = "1"),
    ([Email Id] = USEREMAIL())
  )
)

answers the question, “which rows in User Roles have a Role Id column value of 1 and an Email Id column value matching the current user’s email address provided by USEREMAIL()?” The question you want the answer for Show? is, “are there any rows rows in User Roles that have …?” To do that, just wrap your expression in ISNOTBLANK():

ISNOTBLANK(
  FILTER(
    "User Roles",
    AND(
      ([Role Id] = "1"),
      ([Email Id] = USEREMAIL())
    )
  )
)

See also:

Hi Steve,

Thanks for helping out. The issue is resolved. Is there a way we can limit the data to users as per their company ids. For instance, User with Company Id 1 can only view / update / add the sales made by that respective Company (with Id 1).

Please advise.

Thanks again for your support

Hi @Sam_Bhullar

Please have a look to this article, that may be what you are looking for:

2 Likes