I've got a saved search with 100k records but I on...
# suitescript
g
I've got a saved search with 100k records but I only want it to process 20k per day.
e
You need a mechanism to mark whatever records were processed and you can add logic in your getinputdata stage to only 20k records.
g
Yeah I was thinking I could paginate the results and just run them, store to an object, then return the object when it gets to 20k results
It's either that or somehow abort the map stage when 20k records are run, but I'm not sure that's even possible
Now that I think about, I've got a function for processing search results on my personal computer somewhere, now to find it...
n
You could also just switch your search to a query and do “SELECT TOP 20000 * ….” The return Query.runSuiteQL().asMappedResults()
💯 2
g
I am so doing that!
apartyblob 1
e
runSuiteQL
has a limit of 5,000 results. For more results you need the
runSuiteQLPaged
version.
this 1
e
Along with setting a query result limit I would also recommend adding a condition on either the last modified field OR add a new custom fields that checks the last time your script processed that record