Suppose we have the below Maker and Checker Canvas App, with two button one for raising the request and the other for approving and rejecting the request.
We have below custom security roles created in our Dynamics 365
Here we want Submit a Request button to be visible only to users with Maker security role and the Approve and Reject Request button to users with Checker role.
For this we can write the below formula on Visible property of the button.
Add the Users and Security Roles data sources first.
LookUp([@’Security Roles’], Name = “Maker”, Role) in Concat(LookUp([@Users], ‘Primary Email’ = User().Email).’Security Roles (systemuserroles_association)’, Role & “;”),
Based on email address of the user, we are comparing the Maker security role with all the different roles assigned to the user, which we are fetching from systemuserroles_association.
- User function in Power Apps
- Lookup function in Power Apps
Hope it helps..
If(LookUp([@'Security Roles'], Name = "Maker", Role) in Concat(LookUp([@Users], 'Primary Email' = User().Email).'Security Roles (systemuserroles_association)', Role & ";"), true, false)
5 thoughts on “How to – Hide and show controls in Canvas App based on security role of the user (Dataverse / Dynamics 365)”
Reblogged this on MG and commented:
Show/Hide based on Security Roles.. Canvas App ..Can’t be more Easier!
Do you need a Dynamics 365 environment for this?