web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Hide/Show sections wit...
Power Pages
Unanswered

Hide/Show sections within a Web Page using Web Roles

(0) ShareShare
ReportReport
Posted on by 16

Hi,

 

I have a requirement to Show/Hide sections within a single web page using Web Roles to different types of users. Is it possible to achieve this using Web Roles within a single web page. So any assistance (with some sample) for above requirement will be highly appreciated.

 

Thanks

AR

Categories:
I have the same question (0)
  • OOlashyn Profile Picture
    3,498 Most Valuable Professional on at

    Hi @AR19 ,

     

    You can achieve this using some custom code. First of all web page that you want to show needs to be build using a custom liquid template. In liquid, you have special object called user which contains information about currently logged in user. It has property roles - which is an array of web roles assigned to the user.  You can use special filter has_role to see if the user has a particular role and show section for specific users. For example:

    {% comment %} Check if user has role 'Support User' and assign result to variable called supportUser {% endcomment %}
    {% assign supportUser = user | has_role: 'Support User' %}
    
    {% comment %} Check if user has role 'Regular User' and assign result to variable called regularUser {% endcomment %}
    {% assign regularUser = user | has_role: 'Regular User' %}
    
    {% comment %} check if supportUser and content for them {% endcomment %}
    
    {% if supportUser%}
    <div>Some HTML for SUPPORT USER</div>
    {% endif %}
    
    {% comment %} check if regularUSer and content for them {% endcomment %}
    
    {% if regularUser%}
    <div>Some HTML for REGULAR USER</div>
    {% endif %}

     

    You can find more about using liquid in the portal in this official docs.

     

    Hope this will help.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
rezarizvii Profile Picture

rezarizvii 53

#2
DP_Prabh Profile Picture

DP_Prabh 40

#3
oliver.rodrigues Profile Picture

oliver.rodrigues 28 Most Valuable Professional

Last 30 days Overall leaderboard