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

Filter Accounts Browse Gallery based on Owner

I'm trying to create  a simple filtered Browse Gallery based on a CDS data source. I want to filter the Accounts shown in the gallery to those owned by the currently logged-in user. Below is the formular I'm using but a get an Invalid Argument error on the '=' between Owner and Lookup and there's also a delgation error as you can see from the screenshot below.  Please help me figure out what I'm doing wrong

 

Filter(Accounts,Owner = LookUp(Users,'User Name' = User().Email,User))

 

Filter error.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Filter Accounts Browse Gallery based on Owner

Hi @Edrei1 ,

Do you want to filter your Gallery Items based on the current login user to compare with the Owner field?

 

Based on the formula you provided, I think there is something wrong with it. Actually, the Owner field is a Polymorphic lookups field in CDS. The Owner field refers to a record from either the Teams entity or the Users entity.

 

I have made a test on my side, please take a try with the following workaround:6.JPG

Set the Items property of the Gallery to following:

Filter(TaskLists, Owner=LookUp(Users, 'Full Name'=User().FullName))

On your side, you may type:

Filter(Accounts, Owner=LookUp(Users, 'Full Name'=User().FullName))

or

Filter(Accounts, Owner=LookUp(Users, 'Primary Email'=User().Email))

More details about filter Entity records based on Owner field, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-references#filter-based-on...

 

Above formula may cause a Delegation warning issue, in order to get rid of this Delegation warning issue, please consider take a try with the following workaround:

Set the OnStart property of the App control to following:

Set(CurrentUser, User().FullName);
Set(CurrentUserRecord, LookUp(Users, 'Full Name' = CurrentUser))

Set the Items property of your Gallery to following:

Filter(Accounts, Owner = CurrentUserRecord)

then re-load your app (fire the OnStart property of your App), then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
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

1 REPLY 1
Community Support Team
Community Support Team

Re: Filter Accounts Browse Gallery based on Owner

Hi @Edrei1 ,

Do you want to filter your Gallery Items based on the current login user to compare with the Owner field?

 

Based on the formula you provided, I think there is something wrong with it. Actually, the Owner field is a Polymorphic lookups field in CDS. The Owner field refers to a record from either the Teams entity or the Users entity.

 

I have made a test on my side, please take a try with the following workaround:6.JPG

Set the Items property of the Gallery to following:

Filter(TaskLists, Owner=LookUp(Users, 'Full Name'=User().FullName))

On your side, you may type:

Filter(Accounts, Owner=LookUp(Users, 'Full Name'=User().FullName))

or

Filter(Accounts, Owner=LookUp(Users, 'Primary Email'=User().Email))

More details about filter Entity records based on Owner field, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-references#filter-based-on...

 

Above formula may cause a Delegation warning issue, in order to get rid of this Delegation warning issue, please consider take a try with the following workaround:

Set the OnStart property of the App control to following:

Set(CurrentUser, User().FullName);
Set(CurrentUserRecord, LookUp(Users, 'Full Name' = CurrentUser))

Set the Items property of your Gallery to following:

Filter(Accounts, Owner = CurrentUserRecord)

then re-load your app (fire the OnStart property of your App), then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
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

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (4,827)