I’m trying to build a dialog that will call a whitelisted method, which returns JSON, then format that json into HTML that can be put inside a frappe.msgprint to display.
The async nature of frappe.call seems to be giving me problems when I frappe.call() inside frappe.msgprint.
My client script looks like `
frappe.ui.form.on(“Lead”, “refresh”, function(frm) {
frm.add_custom_button(__(“Search Google Places”), function() {
// When this button is clicked, do this
function jsonToHtml(json) {
let html = ‘
// Recursive function to handle nested objects and arrays
function parseObject(obj) {
// parse the json
}
}
}
}
parseObject(json);
html += ‘
return html;
}
const htmlResult = jsonToHtml(frappe.call(‘googlemapsapi.maps.api.get_place_details’));
// with options
frappe.msgprint({
title: __(‘Notification’),
indicator: ‘green’,
message: __(htmlResult)
});
},__("Actions"));
});
`