cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
d7chang
Frequent Visitor

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
yudhvirc
Power Apps
Power Apps

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
yudhvirc
Power Apps
Power Apps

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) 

 

 

 

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

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)

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)

 

 

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

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?

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)

 

Anonymous
Not applicable

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
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (1,338)