I am trying to get and put last four fields value to my new created record from the latest created in my custom doctype, No luck working the client side scripting in ERPNEXT 13.
I need this to calculate the difference between today and yesterday value, ie:
resultfield = fieldnew1 - field1
Here My Client Script:
frappe.ui.form.on("Monitoring", {
"refresh": function(frm) {
frappe.db.get_list("Monitoring", {fields: ['*'], order_by: "creation desc", limit: 1}).then((result) => {
frm.set_value({"fieldnew1": result.field1, "fieldnew2": result.field2,"fieldnew3": result.field3, "fieldnew4": result.field4 })
frm.save();
})
}
});
What I want is to automatically fill the field value.