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

Power apps portal landing page based on web roles

(0) ShareShare
ReportReport
Posted on by 135

I have a task where i need assign different landing pages based on the web role

{% if user %}
{%assign createResult = sitemarkers['Create Result']%}
{%assign createContact = sitemarkers['Create Contact']%}
{% if user.roles contains ['Employee'] %}
<script>
window.location = '{{createResult.url}}';
</script>
{% else %}
<script>
window.location = '{{createContact.url}}';
</script>
{% endif %}
{% endif %}
This is the code i used in the home web template but when i am pressing on the home button i need to get the home button
instead i am getting the redirected page

I have the same question (0)
  • Nami1 Profile Picture
    135 on at

    i have two web roles when each role logins i need to show different login page

    {% if user %}

      {%assign createResult = sitemarkers['Create Result']%}

      {%assign createContact = sitemarkers['Create Contact']%}

       {% if user.roles contains ['Company Admin'] %}

         <script>

          window.location = '{{createContact.url}}';

         </script>

          {% elseif user.roles contains['Employee'] %}

         <script>

            window.location = '{{createResult.url}}';

         </script>

       {% endif %}

    {% endif %}

    i kept this code in the home webpage for the webroles its working fine

    but when i  click on the home page it should show me home page which is not happening could you tell me how to do that

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Nami1,

    You can refer following video to know how to redirect page based on web role.

    Default Home Landing Page Based on Web Role Associated to Login User | Dynamics CRM 365 - YouTube

    Based on your code:

    As soon as the user logs into the portal, it redirects to these two custom pages instead of the home page, and the same happens when you click the home button.

    So you can refer the following link, which supports user should be redirected to support page after login to Dynamics 365 portal instead of home page. But later they can navigate to home page.

     Redirecting User to Specific Page After Login to Dynamics 365 Portal | HIMBAP

  • Nami1 Profile Picture
    135 on at

    i have tried the video which you suggested already using that code he is redirecting but not able to go back to the home back that was my main concern could you look into it

    Can we do something apart from using session storage because i tried this to

    but when he relogins he wont be able to get the page which i am redirecting

    because he is using session storage

  • Community Member Profile Picture
    on at

    Hi Nami1,

    So you can refer the second link i provided, which may help you.

  • Nami1 Profile Picture
    135 on at

    the second link uses the session storage which works only one time

    is there any solution which works all the time like if the user relogins to

  • Community Member Profile Picture
    on at
  • Nami1 Profile Picture
    135 on at

    I am sorry but the above mentioned link isnt working could you guide me more

    Where i can do it with out using session storage

  • Suggested answer
    Nami1 Profile Picture
    135 on at

    My issue got resolved.

    I used the below code to solve

    I hope it helps.Thank you

    {% if user %}

       {% if user.roles contains 'Company Admin' %}

         <script>

               if(document.referrer.includes('SignIn')){

                 window.location.href = "/createcontact";

               }

              </script>

          {% elseif user.roles contains'Employee' %}

         <script>

          if(document.referrer.includes('SignIn')){

                 window.location.href = "/createresults";

                  }  

         </script>

       {% endif %}

    {% endif %}

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 108 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

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

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans