ERPNext.com Frappe Cloud Support Partners Foundation

FIltering child table field is not working

I put the following code in .js of a doctype. It should filter a field of a child table based on the value selected from another field inside the child table but it is not working. Any help would be appreciate.

frappe.ui.form.on(“Lot List Item”, “refresh”, function(frm, cdt, cdn) {

    row = locals[cdt][cdn]

    frm.set_query("item", function() {

        return {

            "query":"erpnext.controllers.queries.get_item",

            "filters": {

                "item_sub_group": row.item_sub_group,

            }

        };



    });

});

I have the same problem Version 13.7

Should be like below :

frm.set_query(“item”, “items”, function(doc, cdt, cdn) {
const row = locals[cdt][cdn];

  	return {
  		query: "erpnext.controllers.queries.get_item",
  		filters: {
  			'item_sub_group': row.item_sub_grouo
  		}
  	}
  });

should be like this, suppose the parent doctype is Lot List.

frappe.ui.form.on(“Lot List”, “setup”, function(frm) {
    frm.set_query("item", function(doc, cdt, cdn) {
        const row = locals[cdt][cdn];
        return {
            "query":"erpnext.controllers.queries.get_item",
            "filters": {
                "item_sub_group": row.item_sub_group,
            }
        };
    });
});