1

We are trying to change Button Visibility Based on User Role. Added Custom Security Role, Assigned roles to Users from Dynamics 365 environment .

Custom Security roles

Assigned These roles to Users via Manage Roles option.

Manage User Roles

How can we get Role assigned for CurrentUser in Powerapps Environment? Only 3 attributes(Email,fullName,Image) are available for User() object. Tried using Dynamics 365 Users, Security roles etc into Datasource. Also tried by adding Users entity into Datasource.

Dynamics 365 security roles, users in to datasource

Sikha Arun
  • 11
  • 2

1 Answers1

0

In a classic Dynamics CRM web UI or Model driven PowerApp, we have a choice to write client side form scripting to pull current user’s security roles and manipulate the client controls. We will be using web api or odata & utilize the systemuserrolescollection or SystemUserRolesSet dataset to pull the needed data. Read more

But in Canvas apps, even today we are unable to find this System user roles table in Dynamics 365 connectors. So we have to wait till this is exposed.

Or you can have a SQL replication (maybe Data export service) or custom connector which consume the D365 web api to pull this data.

  • Has anything about how Canvas apps interact with the D365 tables changed in the last year as far as this data being exposed? – Christopher Klein Jan 28 '20 at 20:09
  • @ChristopherKlein I have to check, there were revision/different versions of connector came after that – Arun Vinoth-Precog Tech - MVP Jan 28 '20 at 23:29
  • 1
    @ChristopherKlein nah, this is not yet available. Probably you can execute Flow from PowerApps, query using the fetchxml in Flow & return the array to PowerApps and finish the task. https://www.itaintboring.com/dynamics-crm/using-fetchxml-in-the-flows/ and https://powerapps.microsoft.com/en-us/blog/return-an-array-from-flow-to-powerapps-response-method/ – Arun Vinoth-Precog Tech - MVP Feb 03 '20 at 21:45