Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - Power Apps Portals
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

  • OOlashyn Profile Picture
    3,496 Most Valuable Professional on at
    Re: Hide/Show sections within a Web Page using Web Roles

    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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Pages

#1
Lucas001 Profile Picture

Lucas001 60 Super User 2025 Season 1

#2
Fubar Profile Picture

Fubar 55 Super User 2025 Season 1

#3
surya narayanan Profile Picture

surya narayanan 35