Refresh field in child Table

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];

any idea to make it work automatically wiht doc loading

looks like you should -


Thanks for your response but it’s not working do you have any other idea


You can use frm.refresh_field(“accounts”);

Uncaught (in promise) TypeError: me.refresh_field is not a function

You can use frm.refresh_field(“accounts”);

Dear @Solufy
what do you mean for


You can use your field name instead of “accounts”.

i’m already did but not working

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

You have to do some code in the refresh event of the form. Maybe you should loop through the list and set the emails that you want.

Do you have any suggesting for this code

Maybe @Solufy can write something for you


Please refer the below code for same.

frappe.ui.form.on(“Fee Charges Master”, “fee_amount_remove”, function(frm, cdt, cdn) {
// code for calculate total and set on parent field.
console.log(“::::frm:: delete:::”, frm.doc);
total_sum = 0;
$.each(frm.doc.fee_amount || [], function(i, d) {
total_sum += flt(d.amount);
console.log(“::::frm:: total_sum:::”, total_sum);
frm.set_value(“total_amount”, total_sum);

1 Like