How to get roles assigned for an user in Office 36

2019-08-17 11:05发布

问题:

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

回答1:

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.