How can i fetch value from a doctype field to another field in the same doctype.
example
Sales order have total qty i want to populate that total qty to afield in the same doctype how can i achieve that
In a custom client script
frm.set_value('custom_field', frm.doc.total_qty);
frappe.ui.form.on('Sales Order',
{
total_qty: function (frm) {
frm.set_value("custom_total_qty", frm.doc.total_qty);
},
rounded_total: function (frm) {
frm.set_value("custom_rounded_total", frm.doc.rounded_total);
},
net_total: function (frm) {
frm.set_value("custom_net_total", frm.doc.net_total);
}
})
Not working why?
frappe.ui.form.on('Sales Order', {
total_qty: function (frm) {
frm.set_value("custom_total_qty", frm.doc.total_qty);
}
})
Hi @amal_31845
Please check by triggering the refresh
frappe.ui.form.on('Sales Order', {
refresh: function (frm) {
frm.set_value("custom_total_qty", frm.doc.total_qty);
}
})
Thank You!
1 Like