I have a suitelet form which calls a schedule scri...
# suitescript
s
I have a suitelet form which calls a schedule script when submitted . (ASSUME : the sch script takes more than 5 mins to complete it's execution) This Suitelet can be accessed by multiple users/multiple roles at the same time . If diff users submits the suitelet at the same time the sch script will throw an error "Job failed to submit ". Because it's already triggered by an earlier suitelet form . Q : What can we do to overcome this scenario? Can you provide an solution or an alternative to the above case ?
b
have more deployments of the scheduled script
use those deployments instead of the original run to run other requests
n
Use a custom record to work as the "queue" for the pending records. Have the scheduled script pull the data from the custom records and update the status of the record to "processed" when done.
s
Thanks for the workaround .
a
You can queue an Scheduled or Map Reduce script with the task module without specifying the deployment and the task module is going to use the first deployment available(not running), with that in mind, you can create one deployment for your Scheduled script and create a recursive queueScript function that creates a copy of the deployment ONLY when needed(meaning already in use) and call itself again.