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!
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!
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
WarrenBelz
146,651
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,997
Most Valuable Professional