OK... I feel like I'm going crazy here. Does anyon...
# suitescript
j
OK... I feel like I'm going crazy here. Does anyone know why this script would only return one result? When I run the saved script in NetSuite, it returns anywhere from 10 to 3000 results, depending on my criteria, but the script is only logging the first one. I know it's probably something stupid, but for the life of me, I can't figure it out.
Copy code
define(['N/search', 'N/log'], function parentMatrixPriceSync(nSearch, nLog) {
	function execute() {
		nSearch
			.load({
				id: 'customsearch_parentpricingsync',
			})
			.run()
			.each(function eachSearchResult(result) {
				var itemName = result.getValue({ name: 'itemid' });

				nLog.audit('name', itemName);
				nLog.audit('result', result);
			});
	}
	return {
		execute: execute,
	};
});
e
You need to add
return true
to the bottom of your .each function
🙏 1
Copy code
define(['N/search', 'N/log'], function parentMatrixPriceSync(nSearch, nLog) {
	function execute() {
		nSearch
			.load({
				id: 'customsearch_parentpricingsync',
			})
			.run()
			.each(function eachSearchResult(result) {
				var itemName = result.getValue({ name: 'itemid' });

				nLog.audit('name', itemName);
				nLog.audit('result', result);
                return true; // HERE
			});
	}
	return {
		execute: execute,
	};
});
j
🤦‍♂️ Yep. Sure do. Thank you. It's been a long day...
🙌 1