Does anyone know what happens `search.create.promi...
# suitescript
d
Does anyone know what happens
search.create.promise
when there are no results? Does it go to the
catch
?
b
the answer is no, but creating a search and getting its results are different things
d
So, if there are no results, what's passed to the
then
?
b
depends on how you are getting the results
d
Thanks anyway @battk, I'll figure it out
b
your question is skipping steps
1
creating a search returns the search
the search isnt run yet so the number of results it may or may not have is not determined yet
you would have to run the search and then get the results
none of the 3 options for doing so throw errors when there are 0 results
d
certain suitescript Api with 2.1 support
async/await
syntax serverside as well (https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_156042699370.html) might make more straightforward to develop the code that way instead of being stuck in "callback/promise hell" although aside from that, I agree with all the information presented above - all still relevant
d
Thanks everyone
e
An
N/search.Search
instance gets passed to
then()
, regardless of result count. In just the little console tinkering I've done, the methods for retrieving the results (
run()
and
runPaged()
) seem quite finnicky from within the callback.
b
your filters operator is invalid, firstname is not a number
e
Perhaps missing the point
^ Fixed in the snippet and below. Output looks like:
Note the search module is aliased as
s
n
@darrenhillconsulting I agree with @battk. Your question is skipping step. search.create only create the search. It doesn't get any result unless you do run().getRange()
d
Thanks everyone. I was rushed yesterday (no excuse). NetSuite's documentation has the then parameter named
result
so, I jumped to conclusions. Once I took time to read, experiment (and consume everyone's feedback), of course it all makes sense now.
On a side note, how awesome is it to see @erictgrubaugh back into the community!
👋 1