Skip to content

MobileCRM.UI.MessageBox.showAsync

rescocrm edited this page May 15, 2023 · 9 revisions

Shows a popup window allowing user to choose one of actions.

This example demonstrates how to create and display the message box with buttons "YES" and "No".

// WARNING: async/await pattern requires ECMAScript 6 and it's not supported on Internet Explorer.
// It's supported by all modern browsers including mobile version of Chrome and Safari (requires Android 5+ and iOS 10+).
function confirmMsg(title) {
	return __awaiter(this, void 0, void 0, function* () {
		var popup = new MobileCRM.UI.MessageBox(title);
		/// Add the buttons for message box
		popup.items = ["Yes", "No"];
		/// If title is too long set the 'multi-line' to true
		popup.multiLine = true;
		var button = yield popup.showAsync();
		if (button == "Yes")
			MobileCRM.bridge.alert("You taped on 'Yes' button");
		else
			MobileCRM.bridge.alert("You taped on 'NO' button");
	});
}
Clone this wiki locally