Calvin Agar
10/02/2025, 6:14 PMCeligo AI
10/02/2025, 6:14 PMAI generated answer (using internal Slack threads):To query the REST API for states/provinces/counties in NetSuite, you can use the SuiteScript API's
search.create method. Here is an example of how to do this:
javascript
var stateSearchObj = search.create({
type: "state",
filters:
[
["country","anyof","CA"]
],
columns:
[
search.createColumn({
name: "id",
sort: search.Sort.ASC,
label: "Id"
}),
search.createColumn({name: "fullname", label: "Full Name"}),
search.createColumn({name: "shortname", label: "Short Name"}),
search.createColumn({name: "country", label: "Country"}),
search.createColumn({name: "inactive", label: "Inactive"})
]
});
var searchResultCount = stateSearchObj.runPaged().count;
log.debug("stateSearchObj result count",searchResultCount);
stateSearchObj.run().each(function(result){
// .run().each has a limit of 4,000 results
return true;
});
In this example, a search is created for the "state" type. The filter is set to return only states in Canada ("CA"). The columns to be returned are the id, full name, short name, country, and whether the state is inactive. The search is then run and the results are logged.
Please note that the .run().each function has a limit of 4,000 results.
******
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/02/2025, 6:15 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.819580078
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.816040039
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.815673828
Celigo AI
10/02/2025, 6:15 PMCeligo AI
10/23/2025, 2:26 AM