0

Please suggest how to implement Custom List view in LWC which will filter the records based on logged in user and other field criterias because in List view I am unable to define the user information in filter criteria.

1 Answer 1

0

it will be possible with standard list view you dont need lwc custom component.

you just have to create a formula field on object to check logged in user is the concerned user or not.
in formula field you can use $User.Id to get current user id which you can use to compare with your concerned user lookup field. and in list view you can add a filter if this formula field is true or not.

8
  • I tried but it throws the exception in the list view configuration that : Error: The value $User.Id is only allowed in Mobile Configuration Filters. Also I created a formula field and it is returning true but in Listview its not showing the records related to the user
    – user91530
    Commented Aug 8, 2021 at 9:44
  • you have to create a formula field to compare current user. not directly use $user.id in list view filter. did you created formula field? Commented Aug 8, 2021 at 9:46
  • you have to create formula field as per your requirement current user should see which record. lets say you have user lookup on current object (user_lookup__c). and you want to check if this user is logged in and should see list view records. formula will be something like this : IF( user_lookup__c = $User.Id, True, False) Commented Aug 8, 2021 at 9:58
  • Actually I want to show the User's Application based on contact lookup related to case. Lets say if the community user is logged in and his application is assigned to a queue but the contact has his id then it should show his application but it is only considering the owner id then it is showing the records in the listview. I have put if (User.id==contactId,true,false) on case and even formula is returning true it doesnt show the records under list view.
    – user91530
    Commented Aug 8, 2021 at 10:15
  • for community users there is a contact field on user. you can check if that field works for you. IF( contactid = $User.contactid, True, False) assuming you are using standard contact field on case otherwise you can replace first contactid in if condition with api name of contact field. Commented Aug 8, 2021 at 10:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .