darrenhillconsulting
10/29/2025, 2:57 PMCeligo AI
10/29/2025, 2:57 PMAI generated answer (using internal Slack threads):Based on the conversations, it seems that NetSuite does not trigger any User Events when the 'Close' button is clicked on a transaction. This makes it challenging to react to a transaction being closed using SuiteScript. However, a workaround suggested in the threads is to use a User Event (UE) script with a 'Before Load' event. This script would check the status of the transaction and compare it to a custom field that stores the previous status. If the status has changed to 'Closed', the script can then perform the necessary actions. Here is a basic example of how such a script might look:
javascript
/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
*/
define(['N/record', 'N/search'], function(record, search) {
function beforeLoad(context) {
if (context.type !== context.UserEventType.CREATE) {
var transactionRecord = context.newRecord;
var status = transactionRecord.getValue('status');
var previousStatus = transactionRecord.getValue('custbody_previous_status');
if (status === 'Closed' && previousStatus !== 'Closed') {
// Perform necessary actions here
}
// Update the previous status custom field
transactionRecord.setValue('custbody_previous_status', status);
}
}
return {
beforeLoad: beforeLoad
};
});
Please note that this is a simplified example and may need to be adjusted to fit your specific needs. Also, you would need to create a custom field (in this example, 'custbody_previous_status') to store the previous status of the transaction.
******
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
10/29/2025, 2:58 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.842590451
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.820465088
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.818725586
Celigo AI
10/29/2025, 2:58 PM