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

Set variable based on User lookup in SharePoint list

Hi

 

I'm trying to set two variables upon start of a PowerApp.

The variables I'm trying to set are

IsUser = True/False

IsAdmin = True/False

 

The IsUser variable needs to be true if the current user is contained as a user within a SharePoint list Person/Group column.

The IsAdmin variable needs to be true if the User is in the SharePoint list, and the column of that respective user, column AdminRole = Yes. If AdminRole = No then it should set IsAdmin to False.

 

Currently I'm struggeling with the IsUser variable. I tried the below, which doesn't seem to work:

If(User().Email exactin Managers_1.ManagerUser.Email,Set(IsUser, true),Set(IsUser,false))

image.png

 

I can't figure out how to set the IsAdmin variable however, so any pointers here would be great!

 

Below is my config in SharePoint, yes I know i reference Managers_1 above, which is because i created an Icon named Managers:

image.png

The goal with this is to set the Visible of various Menu items to the above values. I know it's probably not the most secure method but generally the access will be limited in the first place so it's okay. Ideally I'd also want to set a Location variable based on which user is signed in to ensure they see what's relevant to their location.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

hi @ChrisRoxor

Can you share a bit more about your issue?

Can you show me “AdminRole column type?

 

I assume that AdminRole column is yes/no type.

 

As an alternative solution, please take a try with the following workaround:

I created a share point list named “test5”.

12.PNG

Set the onstart property of browseScreen1 to :

If(!IsBlank(Filter(test5,User().Email in ManagerUser.Email)),Set(IsUser, true),Set(IsUser,false));If(LookUp(test5,User().Email= ManagerUser.Email,AdminRole)=true,Set(IsAdmin,true),Set(IsAdmin,false))

regards,

eason

 

Community Support Team _ Eason YU
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

hi @ChrisRoxor

Can you share a bit more about your issue?

Can you show me “AdminRole column type?

 

I assume that AdminRole column is yes/no type.

 

As an alternative solution, please take a try with the following workaround:

I created a share point list named “test5”.

12.PNG

Set the onstart property of browseScreen1 to :

If(!IsBlank(Filter(test5,User().Email in ManagerUser.Email)),Set(IsUser, true),Set(IsUser,false));If(LookUp(test5,User().Email= ManagerUser.Email,AdminRole)=true,Set(IsAdmin,true),Set(IsAdmin,false))

regards,

eason

 

Community Support Team _ Eason YU
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted

Hi, that works brilliantly! Thanks
I'm keen to understand why this works and my own original solution didnt.

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

Top Solution Authors
Top Kudoed Authors
Users online (11,609)