yeah you cant keep triggering the same deployment ...
# suitescript
s
yeah you cant keep triggering the same deployment over and over with UE's
c
Thanks @Sandii any suggestions how to handle such case? Or better approach. We are triggering SS to run some logic behind screen which user doesn't need to keep waiting still that process complete.
s
um if you dont want the user to wait you could hit a checkbox on the record, and deploy the scheduled to check every 15 minutes for all records with the checkbox, and uncheck it when finished
w
Depending on the number of deployments/speed of UE save, I've sometimes created an array of deployments and iterate through it until an open dep is found
but that's usually for userinterface actions rather than processing thousands of records that will trigger the UE
c
Thanks @Sandii and @Wreckless we thought of having schedule script running background and process records on some interval, but after thinking it will keep on executing unnecessarily even if records are not created (though nothing to process) we dropped this idea. Having multiple depoyments is fine, but depending on how many records are saving there is chance of failing in this case as well as we dont know how much usebase will be there upfront. Thanks to both of you for your time
b
50 deployments should be safe
c
Thanks @battk, there won't be any limit on deployments in Netsuite?
b
not that i know of, although i havent had to find the limit
c
Ok thank you.
s
You can create a new deployment of the scheduled script each time the UE runs. NetSuite will Queue that deployment... Then at the end of the scheduled process, have the script set its deployment to 'undeployed'. And have a follow-up process which goes behind and deletes those successfully executed deployments which are undeployed. I have been running this solution at volume for a couple of years, and it works well.
^^ You have to schedule the newly created deployment so it will run.
c
Thank you @suitedev. Last point if I understand correctly, do we need to have a scheduled script scheduled to run at interval to clear the executed deployments?
s
Yes, otherwise the undeployed deployments will stack up.
Optional: in the script process, you can also prevent the script from undeploying itself upon an error condition so that you can investigate any exceptions.
c
Got it @suitedev thank you :)
Hi @suitedev, could you please provide sample code for above behavior? How to create deployment from code and clear executed deployments? Thanks in advance.
s
I don't have a sample right now. You would want to schedule the sch or mr using the task module after you create the deployment using the record module.