Fetch value in a child table field from Master

Sample Script to fetch expiry_date field from Batch doctype to Sales Invoice Item table

Step 1: Create Custom Script for _**Sales Invoice**_ (parent) doctype

Step 2: Script as below & Save

frappe.ui.form.on("Sales Invoice Item", "batch\_no", function(frm, cdt, cdn) {
 var d = locals[cdt][cdn];
 frappe.db.get\_value("Batch", {"name": d.batch\_no}, "expiry\_date", function(value) {
 d.expiry\_date = value.expiry\_date;
 });
});
Discard
Save
Was this article helpful?

On this page