Copying a data field value from parent doctype and displaying in child table doctype

Hello Team,

I have created 2 custom fields START DATE and END DATE in Quotation doctype, the difference between these 2 field is number of days( i.e Total Duration=END DATE- START DATE) . I want to copy the TOTAL DURATION data and to display the data in DURATION column(i.e child table ) for all the items. Total Duration will be same for all the items present in child table of Quotation Item. Whatever the value of total duration is present that should be same for all child item in duration column.

I am not getting how to get value from parent field and to display in child table field from 2 different doctypes .

any solutions

Try this
$.each(frm.doc.child_table_name, function(idx, child_row){
var row = frappe.model.add_child(frm.doc, " Child Doctype",“child_doc_name”);
frappe.model.set_value(row.doctype, row.name, ‘duration’,frm.doc.total_duration);
});

1 Like

@Namrata, Thanks for the view. I have written my own custom script and it worked.

would you share your code ?pls , thanks

i try it to copy linked field selection to other one in child table , on validation function but it didn’t work ,