ליאור גבסו
01/19/2025, 12:03 PMCeligo AI
01/19/2025, 12:03 PMAI generated answer (using internal Slack threads):Yes, you can add an alert before closing a sales order in NetSuite. This can be achieved by using a client script with the
saveRecord
event. The saveRecord
event is triggered when a user attempts to save a record. In this event, you can add your logic to check if the sales order is being closed and display an alert accordingly.
However, please note that the 'Close' button on the sales order bypasses client scripts. If you want to control the closing of sales orders with a script, you might need to hide the native 'Close' button and create your own custom button that closes the sales order. You can hide the native 'Close' button by customizing the form and removing the 'Close' action from the Actions subtab.
Here is a simple example of how you might use the saveRecord
event in a client script:
javascript
/**
* @NApiVersion 2.x
* @NScriptType ClientScript
*/
define(['N/currentRecord'], function(currentRecord) {
function saveRecord(context) {
var record = currentRecord.get();
var status = record.getValue('status');
if (status === 'Closed') {
alert('You are about to close this sales order.');
return confirm('Are you sure you want to close this sales order?');
}
return true;
}
return {
saveRecord: saveRecord
};
});
This script will display an alert and a confirmation dialog when a user attempts to close a sales order. If the user cancels the confirmation dialog, the sales order will not be saved.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
01/19/2025, 12:04 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.829439104
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.827029049
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.825428545
Celigo AI
01/19/2025, 12:04 PM