If we need to change the standard alert message of NetSuite (i.e., the ‘No match’ alert message shows when an invalid item is added to the item fulfillment record), add the following code content into the client script – ‘pageInit’ entry point.
pageInit: function (scriptContext) {
try {
const WINDOW_ALERT = window.alert;
window.alert = function () {
console.log(‘Triggered’, arguments);
if (arguments && arguments[0] == ‘No Match.’) {
dialog.alert({
title: ‘Invalid Entry!’,
message: ‘Invalid Item selected. Please try with another item.’
}).then(success).catch(failure);
function success(result) {
}
function failure(reason) {
console.log(“failure”, failure)
}
} else {
WINDOW_ALERT.apply(this, arguments)
}
}
} catch (e) {
console.log(‘err@pageInit’, e)
}
},
The above code section is used when the NetSuite tries to show an alert message “No Match.” then the script will convert the alert message into “Invalid Item selected. Please try with another item.”