https://netsuiteprofessionals.com logo
r

Rywin

04/22/2022, 3:12 AM
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

Ramanand Dubey

04/22/2022, 3:15 AM
Check truthy and falsy value of search object
b

battk

04/22/2022, 3:22 AM
will kinda depend on ho you are getting the search results
r

Rywin

04/22/2022, 3:23 AM
@battk I used .run(); and .getRange({ start : 0, end : 2 });
b

battk

04/22/2022, 3:23 AM
PagedData.count tends to be the cleanest
using getRange means you need to check the length of the array thats returned
r

Rywin

04/22/2022, 3:25 AM
Thank you @battk this is what I am looking for.
r

raghav

04/22/2022, 10:14 PM
Copy code
var searchResultCount = SearchObj.runPaged().count;
will give you the count and if its 0, you have no search results.
2 Views