I’m using below script to get an email address from child table (sales team) into filed in parent doc field called psemail it’s working fine but only when i manually change a value in child table not automatically when document load
frappe.ui.form.on(“Sales Team”, “email”, function(frm,cdt,cdn) {
var d = locals[cdt][cdn];
cur_frm.set_value(“spemail”,d.email);
cur_frm.refresh_fields(‘sales_team’);
});
any idea to make it work automatically wiht doc loading
what happens is when I change sales person name in sales team table it’s working fine and i got the email id in spemail field in the parent doc Event but i need to get it automatically when i refresh the document or even when press save bottom