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)