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

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

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

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 Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (52,617)