NS AdminA
03/17/2025, 2:33 PMCeligo AI
03/17/2025, 2:33 PMAI generated answer (using internal Slack threads):To prevent users from selecting an inactive account on transactions, you can use a SuiteScript. The script would need to be a User Event or Client Script that triggers on the field change event of the account field on the transaction record. The script would check if the selected account is inactive. If it is, the script would return an error message to the user and prevent the transaction from being saved. Here is a basic example of how this could be implemented:
javascript
/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
*/
define(['N/record', 'N/search'], function(record, search) {
function beforeSubmit(context) {
var newRecord = context.newRecord;
var accountId = newRecord.getValue('account');
var accountRecord = record.load({
type: record.Type.ACCOUNT,
id: accountId
});
var isInactive = accountRecord.getValue('isinactive');
if (isInactive) {
throw new Error('Cannot select an inactive account.');
}
}
return {
beforeSubmit: beforeSubmit
};
});
Please note that this is a basic example and may need to be adjusted to fit your specific needs.
******
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
03/17/2025, 2:33 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834646404
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.807242334
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.805319786
Celigo AI
03/17/2025, 2:33 PMmesper
03/17/2025, 2:34 PM