Documentation to Fetch value in Child Table for a field (#14282)

* Fetch value in Child Table for a field

Sample Script to fetch value in child table

* Update fetch value in child table field
This commit is contained in:
Jignesh Greycube 2018-05-30 15:08:55 +05:30 committed by Nabin Hait
parent 6ac9c0f71e
commit 9aca025be2

View File

@ -0,0 +1,17 @@
## Example to fetch value in a child table field from master doctype
### 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;
});
});
```