Microsoft Power Apps Portal Pages How To – Conditionally Show Content Based on Current Logged in User Based on their Web Role

Microsoft Power Apps Series

Table of Contents

Rachel 2022 150x150 1

 

By Rachel Mantei, Dynamics 365 Technical Consultant
2025 Update: This blog was written Power Apps Portal Pages was renamed Power Pages.


Rachel Mantei here with part 3 of 4 of my Microsoft Power Apps Portal Pages How To Series. Part 3 of this series looks at how to conditionally show or hide content based on the current logged in users web role.

Sometimes you need to be able to hide data from CRM based on the logged in user of the portal. There is a quick and easy portion of code that will allow you to do just this!

Within your preferred code editor OR within the portal pages editor, enter this portion of code above the top HTML tag that contains data you want to hide. You are able to include multiple web roles as well by adding commas between the list (see second photo example): 

Screen Shot 2023 04 13 at 9.43.48 AM
Photo 1
A code snippet checks if user_roles contains Web Role1, Web Role2, Web Role3, or Web Role4 in Elementor, then displays a message to enter HTML between the if and endif tags.
Photo 2

With this information, you will be able to show or hide data based on web roles established in the Portal Management app for users in the portal. 

Let us know what scenarios this feature would help you with; we are always excited to hear from our clients and their success stories using Microsoft products. 

Note: This blog was written before Power Apps Portal Pages was renamed to Power Pages.

Join the Community

If you found this blog helpful, subscribe to receive our monthly updates.

Table of Contents

Share with your network

What our Customers Say