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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Role based Screen Navi...
Power Apps
Unanswered

Role based Screen Navigation on click of a button

(0) ShareShare
ReportReport
Posted on by
Hi all,
I am developing an app where there are 3 screens.
  • Home
  • Screen A
  • Screen B
In the Home screen, there is a single button which is used for navigating to Screen A and Screen B.
 
I have a SharePoint List which is connected to this app which has information of all the users of this system. In that list, there is a column named Role. There are 2 types of role.
  • Role A
  • Role B
 
My query is- whenever an user clicks on the button in the Home, if the user is of Role A, it should navigate to Screen A and vice-versa. I am struggling with the function which I should write in the button. Is there anyone who is facing similar issue or have the answer to this?
 
Thanks!
Categories:
I have the same question (0)
  • Gerard Simpson Profile Picture
    2,987 Moderator on at

    Hi @Anonymous 

     

    In the App Onstart set the current user as a variable:

     

    Set(varUser, Lower(User().Email)).

     

    Then in the navigate button use the following

    Navigate(
    If(Lookup(YourList, varUser = ListPersonColumn.Email, RoleColumn) = "RoleA",
    'ScreenA',
    'ScreenB')

     

    Hope this helps

  • Community Power Platform Member Profile Picture
    on at

    Thanks for the answer. But, I can't quite figure out what is wrong here. I am attaching screenshot of my SharePoint List and the formula that I used in the button. 

    rifat007_0-1649178629585.pngrifat007_1-1649178725722.png

     

  • Gerard Simpson Profile Picture
    2,987 Moderator on at

    Looks like you are missing a ')' at the end to close the navigate function

  • Community Power Platform Member Profile Picture
    on at

    My bad. But it is still not working. The User.Email is not working. 

    rifat007_0-1649179474482.png

     

  • Gerard Simpson Profile Picture
    2,987 Moderator on at

    Sorry, I think it was my bad as I had left it out in my original post...

     

    I see the red x - what error message are you getting?

     

    Have you ran app onstart to generate varUser? - Can you show me that formula?

     

    Cheers

  • Gerard Simpson Profile Picture
    2,987 Moderator on at

    @Anonymous - also I see your role field is a choice? - if so if should be..

     

    ...Role.Value

     

    inside your lookup

     

     

  • Community Power Platform Member Profile Picture
    on at

    Yes, I have initialized varUser on start. 

    rifat007_0-1649184174213.png

     

    The error says- 

    Invocation of unknown or unsupported function.
    Invalid use of '.' .

  • Gerard Simpson Profile Picture
    2,987 Moderator on at

    I added a further thought abov on your role choice field, not sure if you have seen it?

  • Community Power Platform Member Profile Picture
    on at

    Yes, I applied Role.Value. It’s still the same. 

  • Verified answer
    Gerard Simpson Profile Picture
    2,987 Moderator on at

    I have dipped in to check this and by using the following code in the button it works fine. My app onstart is the exact same as yours.

     

    AmDev_0-1649192617403.png

     

    Point to note though - when I tried writing this code initially it was a bit temperamental and wouldnt find/predict my person field when trying to write out the lookup function - I ending up testing the lookup result in a separate label first, then copied it in and built the remainder of the expression around it and it was fine. Try that.

     

    Also you could just drop the variable and plug Lower(User().Email) directly into the expression.

     

    Last (first I should say..) thing is to make sure your person / choice fields are not set to allow multiselect in your SharePoint list.

     

    Good luck!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard