Looking for suggestions. I am writing a 2.0 UE scr...
# suitescript
m
Looking for suggestions. I am writing a 2.0 UE script that keeps exceeding SS Usage. I need to update several sublist values on possibly many transaction records. SS Usage to load a transaction is 10 and to save it is 20. That limits me to 33 records. Any ideas other than loading the record, looping the sublist looking for the correct line, updating values, saving the record.
s
You should look into making these updates from a map/reduce script
šŸ‘ 2
m
While I have somewhat looked into that I’m not totally familiar. How would I pass in an arrray of objects for the records to be updated?
s
one way is to create a long text script paramter on the map/reduce and then pass it in that way
or maybe you just pass in the internal id of the transaction you saved and then in the map/reduce do a search to find the transactions you need to update
m
Got it. Thats exactly what I was just thinking. Do all of the work in the map/reduce
Thanks for your help.
s
you can also do it in a scheduled script
mapreduce isn't a magic bullet compared to scheduled scripts - if you don't need parallel execution I'd recommend a scheduled script for its simplified programming model.
šŸ‘ 1
s
you cant pause scheduled scripts in 2.0 like you can in 1.0 though, but you have 10,000 units so you are probably fine to use it.
m
Does the scheduled script run instantly or is it in 15 increments like the UI?
s
when you submit the scheduled script or map/reduce from a script like you are trying to do, it will be immediately added to the queue and if there is a free processor, it will be picked up immediately
šŸ‘ 1
s
Also, I never used 'yieldscript' -> I tend to strongly favor deterministic ending to a script and rescheduling it.
with our libraries, checking for governance and rescheduling is literally one line of boilerplate code so it's no burden.