Today I have read a request in the Microsoft Dynamics CRM Forum, how it would be possible for a manager to assign Security Roles inside the Unified Interface to Enabled Users. My guess, as the Security topics have been moved from Advanced Settings in Classic View to the Power Platform Admin Center in Unified Interface – it is not possible to simply include a Form to the App and that’s it.

So which Options do we have to achieve the requirement?

  1. Develop a PCF to solve this requirement, or – have a look at the and download the existing solution. I have not tested it and I can only rely on the description by the author of the pcf Cathal Noonan.
    But not every company is happy with using pcf controls and my recommendation is to have at least an understanding of what the components are doing and have a look at the source code. When you use a pcf developed by someone else – you may be the one who is responsible for the pcf and who must be able to maintain it.

2. Use either an embedded Canvas app or the new Canvas page feature in the Model Driven App.

And you can achieve the goal with a few steps (Basic functionality will be achievable in less than 10 steps). Okay there will be more steps, if you want to make the Canvas App responsive, but thanks to containers and the instructions by Reza Dorrani it is not too complicated to add responsiveness to the Canvas page. Here you can find Reza’s Power Apps Responsive Design Playlist on YouTube

Therefore, I will focus only on the minimum requirements how to manage Security Roles for Enabled Users from within a Model Driven App:

  1. Open you unmanaged solution with your Model Driven App and edit the App in the New Designer (edit in preview)
  1. Add a new Canvas page to the App and name it e.g., Manage Security Roles

Optional Step: Follow the tutorial by Reza to add different containers to the Canvas App to have Header, Content and Footer of the App responsive – but just for the requested functionality you can skip this step.

  • Insert a Label to the Page, write and format the name of the page how you like it.
  • Add two Dataverse Tables to the page: Users & Security Roles
  • Insert two Vertical Galleries to the page, next to each other. Name the First one galEnabledUsers, Select Users as Source and Enabled Users as View, edit the Fields and select “ThisItem.’Full Name‘ as Title. Name the second Gallery galRelatedSecurityRoles and add the following FX Code for the Items:
    Items=galEnabledUsers.Selected.’Security Roles (systemuserroles_association)’
    Edit the fields that you want to show, e.g., ThisItem.Name, ThisItem.’Is Inherited’, ThisItem.’Business Unit’. Name
  • Insert a Combobox at the bottom of the page name it cboSecurityRoles and use the following Power FX for the Items:
    Items=Filter(‘Security Roles’, ‘Security Roles (Views)’.’Role Associated View’)
  • Insert a button next to the Combobox, name it Relate Role and add the following PowerFX formula to the OnSelect of the button:
    OnSelect=Relate(galEnabledUsers.Selected.’Security Roles (systemuserroles_association)’, cboSecurityRoles.Selected)
  • Select the Rectangle in the Gallery galEnabledUsers and add the PowerFX formula to highlight the selected record with a LightGreen Background:
    Add an Icon to the first cell in the galEnabledUsers Gallery that the user can click on to select a specific user. Leave the OnSelect of the Icon to OnSelect=Select(Parent).
  • Insert an Icon to the first cell in the galRelatedSecurityRole Gallery that the user can click to unrelate a specific Security Role from the selected User and add the PowerFX formula to the OnSelect of the icon:
    OnSelect=Unrelate(galEnabledUsers.Selected.’Security Roles (systemuserroles_association)’, ThisItem)

Save and Publish the Canvas page, Publish the Model Driven App and reload the App (twice?) and you can use the functionality inside your Model Driven App.

No responses yet

Leave a Reply

Your email address will not be published.