YASSER
01/26/2025, 8:15 AMCeligo AI
01/26/2025, 8:15 AMAI generated answer (using internal Slack threads):To prevent a customer from appearing or being selectable when creating an invoice or sales order, you can use a combination of custom fields and SuiteScript. First, create a custom checkbox field on the customer record, let's call it "Exclude from Transactions". When this box is checked, the customer should not appear in the list when creating transactions. Next, you'll need to write a SuiteScript that will filter out these customers when the list is being populated. Here's a basic example of how you might do this:
javascript
function filterCustomers(type){
if(type == 'create'){
var customerSearch = nlapiCreateSearch("customer",
[
["custentity_exclude_from_transactions","is","T"]
],
[
new nlobjSearchColumn("entityid").setSort(false),
new nlobjSearchColumn("companyname"),
new nlobjSearchColumn("custentity_exclude_from_transactions")
]
);
var resultSet = customerSearch.runSearch();
resultSet.forEachResult(function(searchResult){
nlapiRemoveSelectOption('entity', searchResult.getValue('entityid'));
return true;
});
}
}
This script will run when a sales order or invoice is being created, and it will remove any customers from the list where the "Exclude from Transactions" checkbox is checked.
Remember to deploy this script on the sales order and invoice records.
******
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/26/2025, 8:15 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.832340539
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.831499517
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.828863263
Celigo AI
01/26/2025, 8:15 AM