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

filter sharepoint items based on current user

I am trying to filter SharePoint list items on PowerApps so that the current user will view only the items assigned to him or her. I used the gallery and did Items = Filter('Global Ops BI Projects Log List', Assignee_x0020_Email = User().Email), where the condition is that the column "Assignee Email" must equal the current user's. However, the data source for the gallery then disconnects, and I get a blue suggestion button sayint, "Part of this filter formula cannot be evaluated remotely due to service limitations. The local evaluation may produce suboptimal or partial results..." Any solutions/suggestions? Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
PowerApps Staff yudhvirc
PowerApps Staff

Re: filter sharepoint items based on current user

We currently do not support calling of a of User() function in delegable expressions. A workaround for it would be to store the email in a context variable and then using it in the Filter functions. Something like following

 

1. in the OnVisible property for the screen set the context variable

UpdateContext({email: User().Email})

2. Change the items property to then use the variable email. 

Items = Filter('Global Ops BI Projects Log List', Assignee_x0020_Email = email) 

 

 

 

View solution in original post

8 REPLIES 8
PowerApps Staff yudhvirc
PowerApps Staff

Re: filter sharepoint items based on current user

We currently do not support calling of a of User() function in delegable expressions. A workaround for it would be to store the email in a context variable and then using it in the Filter functions. Something like following

 

1. in the OnVisible property for the screen set the context variable

UpdateContext({email: User().Email})

2. Change the items property to then use the variable email. 

Items = Filter('Global Ops BI Projects Log List', Assignee_x0020_Email = email) 

 

 

 

View solution in original post

leyburn19
Level 10

Re: filter sharepoint items based on current user

My issue is similar but I wanted different levels to view.  EG one user can see theirs,  another user can see theirs plus others and a third user could see all.

 

I ended up creating thre email columns in the list Email1, Email2, Email3.  

 

Email1 = had user emails fo the records they were allowed to see

Email2 = The second user who could see user1 plus another user1 etc

Email3 = See all records so their email was in every row

 

I them had a simple startup filter

 

items = Filter(Table,email1=user().email||email2=user().email||email2=user().email)

 

It works OK but gets issues when bandwidth is stretched or the tables are large

 

I am looking for methods to improve this but not quite there

Helen_BB
Level: Powered On

Re: filter sharepoint items based on current user

Hi i am having the same issue, so i have changed it to what you suggested and still getting the 'Part of your forumla cannot be evaluated' error.

 

OnVisible = UpdateContext({Username:User().FullName})

Items = Filter(ApprovalTest,Author.DisplayName=Username)

leyburn19
Level 10

Re: filter sharepoint items based on current user

Is that an error or the blue dot? Blue dot is a delegation issue.  In this case I would have the variable created on the the OnStart to the App.  Eg: Try,  Set(User1,User().Fullname)

 

 

Helen_BB
Level: Powered On

Re: filter sharepoint items based on current user

Yes its a delegation issue, will try your suggestion, Thank you 🙂

Helen_BB
Level: Powered On

Re: filter sharepoint items based on current user

Hello 🙂

 

so at the OnStart i have entered

 

OnStart = Set(User1,User().FullName)

 

and then on my browse Gallery i have entered

 

Items = Filter(ApprovalTest,Author.DisplayName=User1)

 

and i am still getting the delegation issue, any ideas?

leyburn19
Level 10

Re: filter sharepoint items based on current user

I am assuming the issue maybe be with Author.DisplayName.  Two  things:

 

1. Under app settings have you raised threshold for Delegation frm 500 to ??? (can go up to 2000.  as I understand 500 is server side and the rest will be client side.  It helps.  You still get a bluedot warning

 

2. When I do this I actually have a field for the name when a record is created like "User1" or "Email1".  When I create a record in Powerapps it has a default setting agains this field as User().Fullname or User().Email.  I then use this at startup

 

Set(UserloggedIn,User().FullName)

 

then filter galleries as

 

Filter(ApprovalTest,User1=UserloggedIn)

 

KevB
Level: Powered On

Re: filter sharepoint items based on current user

Hi I have tried this and i still have a problem with the filtering by the current user. is there any other assistance you can offer on the following please?

 

I have set 

 

On start  Set(UserloggedIn,User().FullName)

 

Then on my page I have - see attachement.

I have tried to filter on both the BrowseGallery1 and Home without success.

 

Many thanks

 

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 345 members 6,265 guests
Please welcome our newest community members: