Hello everyone. I have a Scheduled Script that ne...
# suitescript
l
Hello everyone. I have a Scheduled Script that needs to run once a day only. It uploads a file to a suppliers SFTP server. This normally runs fine, but once a month or so, their SFTP server is down and the file cannot be sent during the Scheduled Script. I don't want the task to run more often that once a day, unless the file wasn't able to upload. I thought we might be able to use N/task to Schedule something for 60 minutes later, however, it appears the task is run immediately. I don't think I want to bombard their SFTP server will a re-try every 5 minutes or so. Just wondered if anyone had any ideas of the standard practice of solving this problem. Thanks
s
Just one suggestion (there are many possible solutions), but you could create a logging record for this. When the script successfully processes the file, log the date/time processed in a field in a new instance of the custom record type. You can add other useful info to the logging record if needed. Then, schedule the script to run every hour for a 3 or 4 hour window (or however long is necessary) and have the script search for an instance of that custom record with a processed date/time on or after today’s date. If found, do nothing (return immediately). If not found, then proceed with the main script logic. You can also create a cleanup script that deletes these records after some period of time, for example 60 days, or whenever they are no longer relevant
l
@scottvonduhn Thanks for the suggestion. I thought of something like this, but I was hoping for a 'cleaner' solution without having to create other records and additional scripts. It seems like such a logical problem that there should be a solution in place already.
b
nothing really cleaner than @scottvonduhn unless you figure out how to modify script deployment schedules
N/task schedules immediately, so if you wanted 1 hour later your main choice is 23 other script deployments that you deploy or undeploy via script
l
@battk Thanks for your input.