web
You’re offline. This is a read only version of the page.
close
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!

I have the same question (0)
  • Suggested answer
    oliver.rodrigues Profile Picture
    4,052 on at

    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.

  • ecoronado Profile Picture
    15 on at

    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!

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 83 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans