Fetch parent item group name of the current item_group

Hi All,
I am able to fetch the current selected item_group using

frappe.ui.form.on(“Item”, “item_group”, function(frm) {
item_grpname=frm.doc.item_group;
});

I i want to fetch the parent of this item group i fetched, how can i do it in a custom script?

Hi @Vinod_Gangal
The following should help you assuming you expect a js solution.

frappe.db.get_value("Item Group", "Consumable", "parent_item_group", function(r) {
	alert(r.parent_item_group);
})

You could also go the frappe.call way with frappe.client.get_value as the method.
Hope it helps!
EDIT: ‘Consumable’ is an example Item Group, replace it with your item group.
Thank you

Hi @fahimalizain

Thank you. It worked.