Fetch data from child table to custom field not working

i try to fetch data from child table to custom filed in the same doc but not working only working form custom filed to other

@Alaa_Badri Could you share your code to help you

Thanks for your response
cur_frm.add_fetch(ā€œfacilitator tableā€, ā€œfacilitatorā€, ā€œfacilitator_nameā€);

@Alaa_Badri this is not the usage of add_fetch

I will give example of How to get sum of field from child table

frappe.ui.form.on("quotesection", "width", function(frm, cdt, cdn){
  var d = locals[cdt][cdn];
  frappe.model.set_value(d.doctype, d.name, "sqft", d.length * d.width);

  var total = 0;
  frm.doc.quotesection.forEach(function(d) { total += d.sqft; });

  frm.set_value('total_sqft', total);
  refresh_field("total_sqft");

});
1 Like

i try this but not working

frappe.ui.form.on(ā€œeventā€, ā€œfacilitatorā€, function(frm, cdt, cdn){
var d = locals[cdt][cdn];
frappe.model.set_value(d.doctype, d.name, ā€œfacilitatorā€);

frm.set_value(ā€˜facilitator_nameā€™, facilitator);
refresh_field(ā€œfacilitator_nameā€);

});

Screenshot-2018-1-1 New Event 1 - New Event 1

i need the data in Facilitator filed in the table goes to filed Facilitator Name

child table field

Custom Filed in Event doc

Doc witch linked to child table

Dear @Mohammed_Redha

Any update