Table Multiselect in permission Query

I have a doctype called Task, in which I have added a Table Multiselect fields for selecting multiple users. Now I want to filter the list view based on whether the user created the task or task is asssigned to the user. How can this be achieved.


  1. there is a child doctype name is Task User, in which there is one user link field .
  2. via customzie form, added one Table MultiSelect field with Options as Task User.


Create one permission query python script like below

user = frappe.session.user
conditions = f""" (owner = '{user}' or name in 
    (select tu.parent from `tabTask User` tu where tu.user = '{user}')) """