Hi all, I have a SuiteLET where there's a create.s...
# suitescript
h
Hi all, I have a SuiteLET where there's a create.search and it pushes each search result's id to an array. However, there're nearly 100,000 records and the SuiteLET returns null after spinning for a good five minutes. What would be a good alternative to go about doing this?
b
looks mostly reasonable
you can improve pushing into the array by taking advantage that push accepts multiple arguments by using the spread operator
thanks 1
c
I will ask a different question. Are you expecting a human to deal with that many records in a UI? If so, are you certain you're doing the right thing?
h
@CD sorry i'm not following your question
s
Running a search ad hoc with 100k results is rarely going to be performant. Perhaps you should think about summarizing the data this suitelet is trying to retrieve in some sort of daily/background job and have the suitelet pull the summarized data instead. It is difficult to make suggestion withhout knowing why you have 100k search results for something you are trying to display in the UI
c
@Sandii thank you, got there before I did 🙂
h
Actually, the suitelet is just for users to enter the criteria (Date, posting period, etc.,) and then take those criteria into the search. Once they hit Submit, the SL will run the search, push them to the array, paste it as a payload on a custom record, and send the custom record's ID to a MapReduce to process.
The purpose is not to list 100k in the UI
s
Perhaps you should just send the data entered by the user to the map/reduce and let it run the search
âž• 2
c
Or if you can do the hard work in a suiteql query to get it to aggregate down any validation you need, rather than doing a huge search
(if you know SQL)
h
I haven't done suiteql. Will give it a try when i get some time. Thanks for the tips @Sandii and @CD
n
+1 to @Sandii suggestion. Pass the filters to the MR and use that to filter the results. MR can handle those records.
h
Totally agreed with @Sandii. Works like a charm 🙂