Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Redirect based on webrole

(0) ShareShare
ReportReport
Posted on by 15

Hello,

Does anyone know how to redirect a portal contact to a different page after logging in? Currently in my portal after logging in the user is sent to the home page, but I would like to send them to one of two other pages based on their webrole.  I'm guessing this could be done through liquid, but I am not sure how. Or is there a better way to acheive this outside of liquid? Thanks for any help!

  • ecoronado Profile Picture
    ecoronado 15 on at
    RE: Redirect based on webrole

    Hi Oliver,

    Thank you for your reply, but I am still looking for a different result. I adjusted your code to my webroles and sitemarkers and added this to my local Home web page and cleared the cache. Then when I navigate to the site, I am taken to the Sign In page instead of the home page. Once signed in the redirect is set to the second sitemarker in the else statement regardless of webrole. I think this is because the liquid is being evaluated off the anonymous user when first accessing the site. Is there a way for this to evaluate only at sign in? Otherwise the homepage is inaccessible as it always redirects to the sign in page/ Second sitemarker (I have access control rules for each sitemarker used) and I still need anonymous users to see information on the home page. Thank you again for your help!

    Also Thank You for pointing out the PowerUsers community, I will go there for future questions!

  • Suggested answer
    oliver.rodrigues Profile Picture
    oliver.rodrigues 4,052 on at
    RE: Redirect based on webrole

    We highly recommend users to migrate to PowerUsers community for new Portal questions:

    powerusers.microsoft.com/.../PowerAppsPortals

    you can add a liquid code in your Home web page, make sure to add in the content/localized web page and not the root web page

    I would also recommend using sitemarkers to have a "shortcut" to your web page

    your code should look something like:

        {% if user.roles contains 'Administrator' %}
            {% assign redirectURL = sitemarkers["My admin page"].url %}
        {% else %}
            {% assign redirectURL = sitemarkers[" My other page"].url %}
        {% endif %}
        
         

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,307 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans