I tried to create custom script to pull Price List object.
The issue is while the first 2 console.out provides result, the last show undefined.
Based on the order of the printed output, looks like the last console.out was called before frappe.call
Have I done something wrong?
frappe.ui.form.on("Item", {
refresh: function(frm) {
var price_list;
frappe.call({
method: "frappe.client.get",
args: {
doctype: "Price List",
name: "Standard Selling",
},
callback(r) {
if(r.message) {
price_list= r.message;
console.log(price_list.name);
}
console.log(price_list);
}
});
console.log(price_list);
}
});