KM
05/22/2026, 11:17 AMCeligo AI
05/22/2026, 11:17 AMAI generated answer (using internal Slack threads):In SuiteScript 1.0, you can't directly use a formula as a filter in a search. However, you can create a saved search in the NetSuite UI with your formula and then load and run that saved search in your script. Here's a basic example of how you can load and run a saved search in SuiteScript 1.0:
javascript
var filters = new Array();
filters[0] = new nlobjSearchFilter('internalid', null, 'anyof', '1'); // replace '1' with the internal id of your saved search
var columns = new Array();
columns[0] = new nlobjSearchColumn('internalid');
var searchresults = nlapiSearchRecord('transaction', null, filters, columns);
In SuiteScript 2.0, you can use search.filterExpression to add dynamic filters to your search, including formulas. Here's an example:
javascript
var searchObj = search.create({
type: "salesorder",
filters:
[
["type","anyof","SalesOrd"],
"AND",
["mainline","is","T"],
"AND",
["status","anyof","SalesOrd:F"],
"AND",
["formulanumeric: CASE WHEN {quantity} > 0 THEN 1 ELSE 0 END","equalto","1"]
],
columns:
[
search.createColumn({name: "tranid", label: "Document Number"}),
search.createColumn({name: "entity", label: "Name"}),
search.createColumn({name: "quantity", label: "Quantity"})
]
});
var searchResult = searchObj.run().getRange(0, 100);
In this example, the filter expression includes a formula that checks if the quantity is greater than 0.
******
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
05/22/2026, 11:18 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.853210449
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.852111876
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.851135254
Celigo AI
05/22/2026, 11:18 AM