Adding Options to custom filed based on item_code selected in the items child table

Hi @Navya_shree,

Please apply it.

frappe.ui.form.on("Purchase Order Item", {
    item_code: function(frm, cdt, cdn) {
        var row = locals[cdt][cdn];
        if (row.item_code === "a") {
            frm.fields_dict.items.grid.update_docfield_property("custom_mpn","options",["A","B"]);
        } else {
            frm.fields_dict.items.grid.update_docfield_property("custom_mpn","options",["C","D"]);
        }
        frm.refresh_field("items");
    }
});

Output:

Reference:

Thank You!