I was trying to do a if else statement, that if customer field is empty then alert me and else do the frappe.call. Am i doing something wrong? Please help me.
I use this code
function(){
if (frm.doc.customer === “”){
alert(“Working”);
}else{
frappe.call
}
}
This is the frappe.call
function get_items_from_bom(bom) {
frappe.call({
"method": "frappe.client.get",
"args": {
"doctype": "BOM",
"name": bom
},
"callback": function(response) {
var bom = response.message;
bom.items.forEach(function (item) {
var child = cur_frm.add_child('equipment');
frappe.model.set_value(child.doctype, child.name, 'item_code', item.item_code);
frappe.model.set_value(child.doctype, child.name, 'qty', item.qty);
frappe.model.set_value(child.doctype, child.name, 'selling_rate', item.selling_rate);
});
cur_frm.refresh_field('equipment');
}
});