I want to fetch modified data from current date.But the data before current date should not change and data after current data should be fetched. I am not getting the expected output. The “reports to” field has changed and I want to update in the child table from current date.“reports to” field should show old name before a specific date and new name from a specific date in child table.How do I do this? Please help I am new to ERPNext. Below is the code I have tried.
frappe.ui.form.on("Employee",{
"reports_to" : function(frm){
frappe.model.with_doc("Calendar Year", frm.doc.year, function(){
var tabletransfer = frappe.model.get_doc("Calendar Year", frm.doc.year);
$.each(tabletransfer.c_date, function(index, row){
var d = frm.add_child("dsr_submitted");
if (d.date >= now())
{
for(var i = 0; i < cur_frm.doc.dsr_submitted.length; i++)
{
cur_frm.doc.dsr_submitted[i].report_to = cur_frm.doc.reports_to;
cur_frm.doc.dsr_submitted[i].report_to_name = cur_frm.doc.reports_to_name;
}
}
cur_frm.refresh_field('reports_to')
cur_frm.refresh_field('dsr_submitted')
});
});
}
});