cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

One button, 11 different Navigation options

Good Morning Everyone!

 

I have a PowerApp that looks at a SharePoint list and sees if a user can read a specific item in it, and assigns a security variable based on yes or no.  So if a user is a member of a SharePoint group that is for the COO, upon opening the PowerApp the app checks the list, sees the user can see the COO item that COO group has permissions to, and changes a variable in the form called "isCOO" to 1.  This is working flawlessly by the way.  As the app builder, I have permissions to every item in that security list, so my "is" variables all equal 1, which is fine for now and I will work around later by just moving the "IT_View" to first thing that gets checked and navigated to on button press.

 

The problem is, I am trying to use this as my single button navigation to take the user to a specific view based on which role they are or which group they are in, and it's not falling through these checks like I thought it would.  Here is my button commands:

 

If(isAccounting=1,Navigate(Accounting_View));If(isCOO=1,Navigate(COO_View));If(isE1=1,Navigate(E1_View));If(isExec=1,Navigate(Exec_View));If(isHR=1,Navigate(HR_View));If(isIncentive=1,Navigate(Incentives_View));If(isIRX=1,Navigate(IRX_View));If(isIT=1,Navigate(IT_View));If(isMPH=1,Navigate(MPH_View));If(isPayroll=1,Navigate(Payroll_View));Navigate(User_View)

 

I am equaling 1 on every check, but shouldn't it see that on the first check, navigate me to Accounting_View screen, and stop there?  Instead, it takes the button quite a few seconds to process, then dumps me in that VERY last command to navigate to User_View.

 

I want this to navigate the user to the VERY FIRST view that they check in security variables and do no further actions.  What am I missing?  Seems like an easy fix that I am just overlooking....

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Resolver II
Resolver II

@csheets 

 

You want to use a Switch() function or a single If(). PowerApps is not procedural so it continues executing even after a true If() condition. If() supports multiple conditions. 

 

If(isAccounting=1,

Navigate(Accounting_View)),

isCOO=1,
Navigate(COO_View)),
isE1=1,Navigate(E1_View) .... follow same pattern for the remainder of the checks.
Navigate(User_View)
)

 

It might also be clearer to use a local variable to set the screen to and then Navigate at the end.

 

UpdateContext{locScreentoNavigate: 

If(isAccounting=1,

Accounting_View), ...)});

Navigate(locScreentoNavigate)

 

Hope this helps.

 

Mike

View solution in original post

Highlighted

@csheets 

Yep, that should do it.

 

Thanks

View solution in original post

4 REPLIES 4
Highlighted
Resolver II
Resolver II

@csheets 

 

You want to use a Switch() function or a single If(). PowerApps is not procedural so it continues executing even after a true If() condition. If() supports multiple conditions. 

 

If(isAccounting=1,

Navigate(Accounting_View)),

isCOO=1,
Navigate(COO_View)),
isE1=1,Navigate(E1_View) .... follow same pattern for the remainder of the checks.
Navigate(User_View)
)

 

It might also be clearer to use a local variable to set the screen to and then Navigate at the end.

 

UpdateContext{locScreentoNavigate: 

If(isAccounting=1,

Accounting_View), ...)});

Navigate(locScreentoNavigate)

 

Hope this helps.

 

Mike

View solution in original post

Highlighted

So it would look like this, correct?

 

If(isAccounting = 1, Navigate(Accounting_View),
isCOO = 1, Navigate(COO_View),
isE1 = 1, Navigate(E1_View),
isExec = 1, Navigate(Exec_View),
isHR = 1, Navigate(HR_View),
isIncentive = 1, Navigate(Incentives_View),
isIRX = 1, Navigate(IRX_View),
isIT = 1, Navigate(IT_View),
isMPH = 1, Navigate(MPH_View),
isPayroll = 1, Navigate(Payroll_View),
Navigate(User_View))

Highlighted

@csheets 

Yep, that should do it.

 

Thanks

View solution in original post

Highlighted

G

Knee

Us

 

Thanks a ton man!  Much appreciated!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (8,519)