In SuiteScript, I am attempting to run a saved search, which sometimes returns no rows.
Every time the search returns an empty result set, I get the following error:
TypeError: Cannot read property "length" from null
I preface the searchresults.length call with a check to see if searchresults in nothing, null, or searchresults.length is nothing or null....
<strong>if (searchresults.length && searchresults.length != null)</strong>
or<strong>if (searchresults && searchresults != null)</strong>
Neither seems to do the trick. Any ideas?