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))
Solved! Go to Solution.
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:
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:
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,
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:
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:
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,
User | Count |
---|---|
181 | |
123 | |
88 | |
44 | |
43 |
User | Count |
---|---|
247 | |
156 | |
127 | |
78 | |
73 |