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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / User login based on Us...
Power Apps
Answered

User login based on User Rule using switch function

(1) ShareShare
ReportReport
Posted on by 8

Good day,

I hope I can get some guidance and answer on this one.

 

I'm getting error with my user role switch function with my login. 

I'm using switch function to validate the 'User Role' column in my SharePoint list

if it's "Superuser", "User", "Approver", and "Director". 

 

Please note that I used the choice type for 'User Role' column.

 

Please see attached picture of my code and where I'm getting an error.

Thank you in advanced folks!

UserRoleColumn.png
Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    155,623 Most Valuable Professional on at

    Hi @rpatricio ,

    Can you please remember to post your code in Text as it saves re-typing here. This code is OCR'd, so please watch spelling. I am not sure exactly what you are trying to do here - you seem to have a mixture of navigation functions and Table values - is this the structure you are attempting ?

    With(
       {
          _Role
          LookUp(
             tbl_logins,
             User().Email = txtUser.Text And Password = txtPass.Text
          ).'User Role'.Value
       },
       If(
          IsBlankOrError(_Role),
      Notify( "You don't have permission to login this account", NotificationType.Error ), Switch( _Role, "Superuser", Navigate(adminHomeScreen), "User", Navigate(userScreen), "Approver", Navigate(approverScreen), "Director", Navigate(directorScreen), Navigate(whateverScreen), ) )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

     

  • rpatricio Profile Picture
    8 on at

    Thank you @WarrenBelz and Noted with posting the codes in Text. Problem solved! All I needed was the .Value after the 'User Role'. Thanks again!

  • pankajrana Profile Picture
    8 on at
    ​​​​​​​thanks this helped

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 413

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
timl Profile Picture

timl 315 Super User 2026 Season 1

Last 30 days Overall leaderboard