How do I avoid SSS_USAGE_LIMIT_EXCEEDED in a Map/Reduce script?
Sign Up to our social questions and Answers Engine to ask questions, answer peopleβs questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer peopleβs questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This error means your script hit NetSuiteβs governance usage limit (e.g., 10,000 units for Map/Reduce). To avoid it:
Use the right script type:
For bulk processing, use Map/Reduce instead of Scheduled or User Event scripts. Map/Reduce is designed to break data into small chunks.
Batch data:
If processing search results, fetch in pages (e.g., 500 or 1,000 at a time). Use
search.runPaged({pageSize: 500})
.Lightweight map stage:
Do only lightweight tasks in
map()
and push data intoreduce()
. Example: pass record IDs instead of full objects.Check remaining usage:
const remaining = runtime.getCurrentScript().getRemainingUsage();
if (remaining < 200) {
// reschedule or yield
return;
}
Yield in long loops (Scheduled scripts):
If stuck with Scheduled scripts, use
nlapiYieldScript()
(1.0) or break loops manually.π Best Practice: Always design Map/Reduce as stateless batches β if one chunk fails, others continue.