cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Reply
RobertC71
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
mdevaney
Super User III
Super User III

@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
mdevaney
Super User III
Super User III

@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

Shanescows
Super User
Super User

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

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

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 the go-to Power Platform destination for ISVโ€™s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (66,023)