ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Fetching value from another DocType to display in customised field


#1
frappe.ui.form.on("Sales Invoice", "type_of_customer", function(frm, cdt, cdn) {
    var job = frappe.get_doc(cdt, cdn);
    if (job.type_of_customer == "Retail Customers") {
         cur_frm.set_value("retail_address", frappe.db.get_value('Contact', contact, 'address'));
    }
})

I’m trying to fetch the address field from Contact doctype but it seems my code is not working.


#2

@Justin_Lu frappe.db dont exists in client side

Take a look in this discussion, it will provide to you the bases of what do you need Custom script - fetch data


#3

@Justin_Lu Is this solved?
For fetching address you can try this code sample