Happy Friday, I'm running saved search in a Map Re...
# suitescript
c
Happy Friday, I'm running saved search in a Map Reduce and it works great in sandbox, but the same exact code errors out in Prod. I'm getting an odd timeout error:
Script Execution Time Exceeded. at :=> at Array.prototype.forEach (<builtin>:1:0) at getInputData (/SuiteScripts/Map Reduce/bp_blank_mr.js:23-28:941-1135) at Array.prototype.forEach (<builtin>:1:0) at getInputData (/SuiteScripts/Map Reduce/bp_blank_mr.js:21-29:797-1152) at org.graalvm.polyglot.Value<InteropBoundFunction>.execute
It's like the search runs, but the paging doesn't work fast enough. Here is the code:
Copy code
const resultCount = srch.runPaged().count;
		var pagedData = srch.runPaged({ pageSize: 1000 });
		pagedData.pageRanges.forEach(function (pageRange) {
			var myPage = pagedData.fetch({ index: pageRange.index });
			myPage.data.forEach(r => {
				citations.push({
					citationid: parseInt(r.id)
				});
				return true;
			});
		});
Sandbox will process a couple hundred thousand search results like this, but prod can't do 20k. It's odd.
b
You might want to try passing the search object directly to map/reduce steps and let those handle it, you don't need to run the search and extract the citationId, that's unless of course you are massaging the data prior to the next step. Alternatively, it's possible that Production data is very different from Sandbox as in records having more data, you might want to reduce the number of columns or compare the search results and see if that gives you a hint.
👍🏻 1
c
Good suggestions. Thank you.
This helped quite a bit, actually.
👍 2
s
I generally try to provide the simplest thing possible as a return value from
getInputData()
. Usually that means returning an object literal referencing a saved search or a SuiteQL query.