Good day, in SuiteScript 2.0 how would you detect ...
# suitescript
r
Good day, in SuiteScript 2.0 how would you detect if a search.create returns no results? This is like having a Saved Search in the UI, there is no results in the Saved Search. Thank you for answering
1
r
Check truthy and falsy value of search object
b
will kinda depend on ho you are getting the search results
r
@battk I used .run(); and .getRange({ start : 0, end : 2 });
b
PagedData.count tends to be the cleanest
using getRange means you need to check the length of the array thats returned
r
Thank you @battk this is what I am looking for.
r
Copy code
var searchResultCount = SearchObj.runPaged().count;
will give you the count and if its 0, you have no search results.