cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Manager Button Access

I am creating an app that has two button, Employee Access and Manager Access.  When a user clicks the Manager Access button, I want the user to be compared to the Manager list in Collections (a SP list).  I was thinking of using an IF statement on the OnSelect of the button.   I'm using a similar layout as the Request Leave template.  Unfortunately, the template isn't complete in that anyone can click on the Manager button. Thanks in advance.

 

This is what I currently have in the OnSelect:

    Set(_managerView,true);
    Navigate(ManagerApproveScreen,None)

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Manager Button Access

@RobertC71 

 

The User() function can give details about the current user.  For instance, User().Email would return something like robert@yourcompany.com

 

Assuming all managers in ManagerList have their email in a column named MgrEmail you could check if they are on the list using the following code.

 

Not(IsBlank(LookUp(ManagerList,MgrEmail=User().Email,MgrEmail)))

 

You could even put it in the Visible property of your button to make the button disappear when not a manager.

 

If(Not(IsBlank(LookUp(ManagerList,MgrEmail=User().Email,MgrEmail))),true,false)

 

Hopefully this points you in the right direction.  Note: you could also try User().FullName which would return something like "John Smith" but you might encounter duplicate names.

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

View solution in original post

3 REPLIES 3
Highlighted
Super User III
Super User III

Re: Manager Button Access

@RobertC71 

 

The User() function can give details about the current user.  For instance, User().Email would return something like robert@yourcompany.com

 

Assuming all managers in ManagerList have their email in a column named MgrEmail you could check if they are on the list using the following code.

 

Not(IsBlank(LookUp(ManagerList,MgrEmail=User().Email,MgrEmail)))

 

You could even put it in the Visible property of your button to make the button disappear when not a manager.

 

If(Not(IsBlank(LookUp(ManagerList,MgrEmail=User().Email,MgrEmail))),true,false)

 

Hopefully this points you in the right direction.  Note: you could also try User().FullName which would return something like "John Smith" but you might encounter duplicate names.

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

View solution in original post

Highlighted
Super User
Super User

Re: Manager Button Access

I made a video on this. 😀

https://youtu.be/0MB-z9cyFCQ



Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
Highlighted
Frequent Visitor

Re: Manager Button Access

This work perfectly. Thank you.  

 

This my change just in case someone in the future wants to navigate to a different screen when not logging in as a manager.

If(Not(IsBlank(LookUp(Managers,Title=varCurrentUser.Mail,Title))),Navigate(ManagerApproveScreen,None),Navigate(myLeaveScreen,None))

Title is just the field in my SP list where I stored the department managers email.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,834)