How to handle when we get more result form saved search in suitelet and get SSS_USAGE_LIMIT_EXCEEDED
Hello Everyone,
I have created a suitelet where I have to field “Start Date” and “End Date”. on the basis of the this two date the amount of sales order is coming via saved search. but when script consumed 1000 governance unit it shows error “SSS_USAGE_LIMIT_EXCEEDED”.
So how can we handle it in suitelet.?
Please guide and help…..
Thanks.!
1000 governance points is exceedingly difficult to reach, even when reading search results. You are likely doing something else very inefficient.

May be… It can be inefficient but I have achieved as per the requirement. but getting error when search returns more then 1000 records.. if you can suggest efficient so I can share the requirement as well.
see, actually – user will enter the From Date and End date and then on the basis of the date data will come.
Customer Cohort | Total | Average | Jan-20 | Feb-20 | Mar-20 | Apr-20 | … |
Jan-20 | $ 570,000.00 | $ 114,000.00 | $ 100,000.00 | $ 90,000.00 | $ 80,000.00 | $ 100,000.00 | |
Feb-20 | $ 415,000.00 | $ 83,000.00 | $ – | $ 200,000.00 | $ 50,000.00 | $ 65,000.00 | |
Mar-20 | $ 270,000.00 | $ 54,000.00 | $ – | $ – | $ 50,000.00 | $ 20,000.00 | |
Apr-20 | $ 340,000.00 | $ 68,000.00 | $ – | $ – | $ – | $ 40,000.00 |
Cohort contain the all customer who have given the First Sale on respective month and then sales by the same customer for rest of the month.
Please suggest something efficient.. Thanks.!
It is odd that you are running into governance while reading search results unless your doing something else that consumes governance for each result.
It’s hard to make any recommendations on how to handle governance without viewing your code.
You may be able to optimize the script to reduce governance.
If you can’t optimize you are going to need to find a way to break up the processing between multiple runs.
1. You could use a map/reduce script that has a lot of advantages when processing large amounts of data.
2. You can use a scheduled script that can process results until governance runs low and then reschedule. You can query governance remaining with the N/runtime module.

Understand Marvinroman – its hard to suggest and idea without viewing code but please see the requirement (above comment). I would show you or talk about my logic as well..
And I cant use map/reduce and scheduled script because the whole process is customize means I am doing it on suitelet so we do not have any option.
You can use the following function:
Thanks @Alyesmael22. will try this or check whether its working or not.