HOW TO DISPLAY AN ALERT IN POWER APPS USING JAVASCRIPT
When using JavaScript, we can display alerts in model-driven Power Apps. To do this, we can use openAlertDialog.
The syntax for this method looks like below:
Xrm.Navigation.openAlertDialog(alertStrings,alertOptions).then(closeCallback,errorCallback);
As a simple example, we can use:
var confirmStrings = { text:"This is a confirmation.", title:"Confirmation Dialog" };
var confirmOptions = { height: 200, width: 450 };
Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(
function (success) {
if (success.confirmed)
console.log("Dialog closed using OK button.");
else
console.log("Dialog closed using Cancel button or X.");
});