How to fetch item in specific item group


How to fetch item in specific item group
eg :I want to fetch items which is in the item group consumables and show inthe next field as drop down

Hi @amal_31845,

Please check the documentation of the Overriding Link Query By Custom Script.

Lots of examples are already available in the forum so please search like frm.set_query

frappe.ui.form.on('DocType', {
    refresh: function(frm) {
        frm.set_query("item_code", function() {
            return {
                "filters": {
                    "item_group": frm.doc.item_group
                }
            };
        });
    },
});

Please set the doctype name and field name.

1 Like
frappe.ui.form.on('Issue Type', {
    custom_item_group: function(frm) {
        frm.set_query("custom_item", function() {
            return {
                "filters": {
                    "item_group": frm.doc.custom_item_group
                }
            };
        });
    },
});

not working

Please check the doctype name and field name. The same scenario was applied from my end and worked properly.

2 Likes

Yeah it is working