This topic contains 4 replies, has 0 voices, and was last updated by mwhite@hgyp.com 7 years ago.
-
AuthorPosts
-
October 23, 2017 at 2:49 pm #17877
ajrey77I’m running a scheduled script that runs out of governance about half way through the record set. How do I capture the last record processed and then tell the script to restart at the next result in the search?
This is a cached copy. Click here to see the original post. -
October 23, 2017 at 3:42 pm #17878
khultquistTwo ways to handle it:
1. in your results loop, add a condition that the nlapiGetContext().getRemainingUsage() > some value that will prevent partial execution. Then schedule the script to run again. This works if a record is removed from your search results after being edited by the script.
2. use nlapiSetRecoveryPoint() or nlapiYieldScript()
ajrey77 replied on 10/23/2017, 03:54 PM: How would that occur in SS 2.0?
-
October 23, 2017 at 5:23 pm #17879
pcutlerkhultquist Is correct, those are both good approaches. Other approaches would include a mass update script or a map/reduce script since governance limits are for each record.
As far as more details on a simple solution (applies to ss 1.0 or 2ss 2.0):Create a checkbox on the record type your processing
Create a saved search of records to process that excludes records with the checkbox checked
Write your script to process results from the saved search
Have your script check the remaining usage and reschedule itself when less than x governance points remaining. The amount depends on how many governance points you need per record. Scheduling scripts is in the N/task module. -
October 23, 2017 at 11:11 pm #17880
Vesku1980Hi
Can you share your script?
It is possibile that you do something that can ne done different way to use less usage points.
Vesku
-
October 25, 2017 at 7:48 pm #17881
mwhite@hgyp.comI agree with @pcutier. Using a Saved Search as your work queue is definitely the way to go. If that’s not possible for some reason, I would recommend a custom record to save the starting point and calculations in progress.
-
AuthorPosts
You must be logged in to reply to this topic.