/**
* @NApiVersion 2.x
* @NScriptType ClientScript
*/
define(['N/ui/dialog'], function(dialog) {
function showAlert() {
swal("Hello, world!");
}
function showConfirmation() {
swal({
title: "Are you sure?",
text: "Once deleted, you will not be able to recover this record!",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then((willDelete) => {
if (willDelete) {
swal("Poof! Your record has been deleted!", {
icon: "success",
});
} else {
swal("Your record is safe!");
}
});
}
return {
pageInit: function(context) {
// Example usage when page loads
showAlert();
},
showAlert: showAlert,
showConfirmation: showConfirmation
};
});