We have to get the security roles of logged in user, and store in the collection of the app to reuse it across the app and to avoid multiple request to Dataverse

To get the security roles of logged in user, write the below Fx function

ClearCollect(UserRoles, (LookUp(Users,domainname = User().Email).'Security Roles (systemuserroles_association)').Name)

We have to add this function on the app start, here User().Email gives logged in email address based on that get the security roles associated to the user

Click on App and Run On Start to see the collection

Now that collection is available in the app, we can use it to validate the required security role

If(IsBlank(LookUp(UserRoles,Name="Basic User")),Navigate(ErrorScreen),Navigate(HomeScreen))

If the 'Basic user' is present in User Roles collection then Navigate to Home Screen else Navigate to Error Screen

Hope its helpful..! 🙂


This free site is ad-supported. Learn more