Refreshing a child doctype

Good day, to all!

I need some help with my script. I would like to refresh child doctype after picking another item in a select.
Already used the following:
frm.refresh();
frm.reload();
refresh_field(“time_logs”);

Can anyone lead me to a solution? :smiley:

refresh_field("child_table_fieldname") should work. But it will always better if you can share your code.

1 Like

Thank you for the response @nabinhait ! Sample code is below :slight_smile:

cur_frm.cscript.schedule_type = function( doc, cdt, cdn) {
var d = locals[cdt][cdn];
frappe.call({
method: "sample.dtr.checkTimesheet.getAttendance",
args: {
"date": d.attendance_date,
"employee": cur_frm.doc.employee,
"schedule_type": d.schedule_type,
"timesheet": cur_frm.doc.name
},
callback: function (r) {
//***DO SOMETHING***//
}
});
refresh_field("time_logs");
};```

You should refresh “time_logs” table inside callback function. Otherwise, due to javascript’s asynchronous behavior, it will get executed before returning your server ajax call.

1 Like

Thank you so much, @nabinhait! Sorry for the late reply.