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 / User login based on Us...
Power Apps
Unanswered

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!

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,034 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

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard