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

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
Community Support Team
Community Support Team

Re: Set variable based on User lookup in SharePoint list

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
Community Support Team
Community Support Team

Re: Set variable based on User lookup in SharePoint list

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

ChrisRoxor
Level: Powered On

Re: Set variable based on User lookup in SharePoint list

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

Helpful resources

Announcements
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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,786)