Try ERPNext Buy Support Partners Foundation Foundation Members

Set Query Not Working for Link field

frappe.ui.form.on("Sales Invoice", {
  onload: function(frm){
      cur_frm.set_query("customer", function() {
            return {
                "filters": {
                    "customer_group": "Commercial"
                }
            };
        });
    }
});

I think your code will work if rather than setting it on onload you use it on the field customer itself. Just replace onload with customer and all should be okay.

Replace onload with refresh

Hello Jatin,

Thanks for your answer, i have tried with customer but still not working.

Hello Misbah

Tried with refresh but still not working.

Thanks

set queries not used to work for Customer and Supplier in version 9 in the latest version I have not checked

Try to place cur_frm outside the scope of frappe.ui.form