cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
RobertC71
Level: Powered On

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
Super User
Super User

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
Super User
Super User

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

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
RobertC71
Level: Powered On

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
thirdimage

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors
Users online (6,122)