frappe.listview_settings['Customer'] = {
formatters: {
mobile_no: function(value, field, doc) {
frappe.call({method: 'wi_app.api.customer.get_customer_contact',
args: { name: doc.customer_name}}).then(function(result) {
}).then(r => { return r.message.phone })
},
// return "val_here"
// if I put above `return` it show up, I want to return from call back to here.
}
}
Instead of doing a .then(), try giving the return within the callback parameter. Also try adding the async: false parameter if you get a return object promise.
This looks like a bad idea in the first place, you shouldn’t be having a frappe.call in formatters.
Imagine the number of db calls on a list view with 500 documents!
Rather, whatever details it is, have it stored in the customer itself and show it in the list view.