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 / Switch Statement not w...
Power Apps
Unanswered

Switch Statement not working?

(0) ShareShare
ReportReport
Posted on by 69

I'm building an employee evaluation SharePoint list and I'm actually working with SharePoint integration to build a custom form.

 

In the OnStart property of my app in order for the form to open up on the right screen I am using a switch statement that looks at both the currently logged in User and what the Status Column on the list is set at. We need to do it this way because the list is intended to capture the whole evaluation process but different users are in play at different points.

 

Right now I have conditions in place where I am an Employee being reviewed and a manager of an employee it shows the  'Employee Submit Documents' screen. Likewise, if I hit the New Button in SharePoint to create a new record it pulls up the  'Employee Submit Documents' screen instead of the 'New Evaluation Screen'.

 

Can anyone tell me where I am going wrong? If it matters, Status is a Choice Column. 

 

Set(CurrentUser, User());
Switch(CurrentUser.Email && SharePointIntegration.Selected.Status.Value,
SharePointIntegration.Selected.Employee.Email && "Not Started", Navigate('Employee Submit Documents'),

SharePointIntegration.Selected.Manager.Email && "Employee Uploaded Documents", Navigate('Manager Review'),
SharePointIntegration.Selected.Supervisor.Email && "Manager Submitted Review", Navigate('Supervisor Review'),
"HR@email.org" && "Supervisor Reviewed", Navigate('HR Review'),
SharePointIntegration.Selected.Manager.Email && "HR Reviewed", Navigate('Meeting Completed'),
[Navigate('New Evaluation')])

Screenshot 2023-10-31 091038.png
Categories:
I have the same question (0)
  • AhmedSalih Profile Picture
    6,680 Moderator on at

    hello @Acruz5 , Would you please try this formula instead:

    Set(CurrentUser, User());
    Set(CurrentStatus, SharePointIntegration.Selected.Status.Value);
    Set(EmployeeEmail, SharePointIntegration.Selected.Employee.Email);
    Set(ManagerEmail, SharePointIntegration.Selected.Manager.Email);
    Set(SupervisorEmail, SharePointIntegration.Selected.Supervisor.Email);
    
    If(
     CurrentUser.Email = EmployeeEmail && CurrentStatus = "Not Started",
     Navigate('Employee Submit Documents'),
     
     CurrentUser.Email = ManagerEmail && CurrentStatus = "Employee Uploaded Documents",
     Navigate('Manager Review'),
    
     CurrentUser.Email = SupervisorEmail && CurrentStatus = "Manager Submitted Review",
     Navigate('Supervisor Review'),
    
     CurrentUser.Email = "HR@email.org" && CurrentStatus = "Supervisor Reviewed",
     Navigate('HR Review'),
    
     CurrentUser.Email = ManagerEmail && CurrentStatus = "HR Reviewed",
     Navigate('Meeting Completed'),
    
     Navigate('New Evaluation')
    )
    

     

     

    If my reply helped you, please give a 👍 If it solved your issue, please give a 👍 & accept it as the Solution to help other community members find it more.

    Visit my Blog: ahmedsalih.blog

    Visit my YouTube Channel: https://www.youtube.com/@powerplatformplace/videos

    Microsoft Business Application MVP

  • Acruz5 Profile Picture
    69 on at

    Uh now no matter which button is clicked it goes to the "New Evaluation" Screen.

  • AhmedSalih Profile Picture
    6,680 Moderator on at

    @Acruz5, That means non of the conditions have been met. Check your values.

  • Acruz5 Profile Picture
    69 on at

    @AhmedSalih 

    Right but the conditions are being met. I have placed myself in the Employee Column, in one record. The Manager Column in another, and the Supervisor column in yet another record. At  first I thought it was because I was on more than one record so I deleted myself down to just record where I placed myself as the manager and the status as "Employee Uploaded Documents" but that still has it navigating to the Else condition of the "New Evaluation" Screen. 

  • AhmedSalih Profile Picture
    6,680 Moderator on at

    @Acruz5, create a variable and set it to this right after the rest of your global variable and see if the value of the variable is true:

    Set(glbCheck, CurrentUser.Email = ManagerEmail && CurrentStatus = "Employee Uploaded Documents")
  • Acruz5 Profile Picture
    69 on at

    Can't get that to work.

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 429 Most Valuable Professional

#2
11manish Profile Picture

11manish 191 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 122 Super User 2026 Season 2

Last 30 days Overall leaderboard