Hi All,
In Lead doctype, i had created customized childtable “Lead Item” and fieldname “custom items” i need to fetch these values in Deal(opportunity)
frappe.ui.form.on(‘Opportunity Item’, {
refresh: function(frm) {
if (frm.doc.__islocal && frm.doc.from_lead) {
frappe.call({
method: ‘frappe.client.get’,
args: {
doctype: ‘Lead’,
name: frm.doc.from_lead
},
callback: function(r) {
if (r.message) {
const lead_items = r.message.custom_items || ;
if (lead_items.length > 0) {
frm.clear_table(‘items’);
lead_items.forEach(item => {
let child = frm.add_child(‘items’);
child.item_code = item.item_code;
child.item_name = item.item_name;
child.description = item.description;
child.qty = item.qty;
child.rate = item.rate;
child.amount = item.amount;
child.vertical = item.custom_vertical;
child.product_type = item.custom_product_type;
child.license_types = item.custom_license_types;
// Map any other fields you have in the child tables
});
frm.refresh_field(‘items’);
}
}
}
});
}
}
});
this code i had written but not working if anybody give me a solution for this
Thanks in Advance