How to set filter query on items while creating invoice using Dynamic condition

for example when i select a customer 1 , customer 2 , customer 3

items will bi fiterd as per customer

how i can setup this

we have more then 10000 items
and we have to find wich ite belong to specific customer and same item we cannon use for other customers

if any method
we filter based on select customer
and items will be filtered as per customer

Hello @Galaxy_Lab

To apply a filter in a specific link field, you can use frappe.set_query. Here’s an example:

onload: function (frm) {
    frm.set_query("item", function () {
        return {
            filters: {
                customer: frm.doc.customer,
            },
        };
    });
},

Please adjust the field names as needed. I hope this helps!

Thanks let me try this