# Automated Tasks Overview

Orderwave supports different types of automated tasks that help you automate all sorts of processes for your business. Here are the different types of automated tasks that you create in Orderwave:

Task type Description
Export job Export data from Orderwave and send it to a FTP/SFTP server or web service.
Import job Import data into Orderwave from a file that is on a FTP/SFTP server.
App job Run a built-in process that Orderwave provides.
Rules job Run a Rule on a set of records in you buckets. Rules can change data, send emails, queue or tag items, etc.
Alert job Create alerts to team members based on saved search filters on your buckets.
Execute a URL Periodically hit a URL on an external server that does custom programming or triggers a process.

# Recurrence

Automated tasks typically run on a recurring schedule. When creating any type of automated tasks, you have the option to specify the recurrence options:

Field Description
Frequency The numeric value of how often the task will run.
Recurrence The period to apply to the Frequency, such as 'Hour', 'Day', etc.
Start On The date and time that the automated task should first run. By default, this field will be filled with a date and time that is a half an hour in the future. If you need your task to run every hour at a specific time, make sure to choose that specific time as the start time. For new automated tasks, your task must start in the future.
End On The date and time that the automated task should stop running. By default, this will be filled with a date and time 30 years from now.
Maximum Runs The maximum number of times that this automated task should be executed. Leave this value to 0 to have no limit. Setting a value of 1 ensures that the task will only be executed one time, 2 will have it run twice, and so on.

# On-demand tasks

Sometimes, you may want to create a task to run a job on-demand. This can be useful for rules jobs and other job types. In this case, create the automated task as usual, but do not enable the automate task after setting the job properties. You can then use the Run button at the top of the screen to run the task on-demand.

# Automated Task Gates

All automated tasks are configured to only run once at a time, which means that a particular task cannot run in parallel with itself. For example, the PAYMENT-PROCESSING automated task (App Job) cannot run more than once at a time. If you attempt to run an automated task while it is already running, you will encounter an error that it cannot run, since it was prevented by an automated task gate.

An Automated Task Gate is a special bucket that controls the start and end of an automated task. When a task starts, an automated task gate is created for that particular run. When the task completes (successfully or unsuccessfully), the automated task gate is deleted/archived.

In the event that an automated task fails in some sort of unexpected way, the automated task gate will not be removed, and that task cannot run until the automated task gate is removed.

# Manual removal of automated task gates

To manually remove an automated task gate, navigate to Admin > (scroll down to the bottom) Data Browser > Automated Task Gates. Locate the automated task gate you need to remove, and click the checkbox on its row. Click the "Archive" button that appears after you've checked the box. Follow the prompts on the screen to delete/archive the automated task gate. Now the automated task can run again.

# Automated removal of automated task gates

Automated task gates are removed after six hours, however, by using a saved-filter and a rule on the automated task gate bucket bpa/automatedTaskGates, you could create an automated task (rules-job) that deletes/archives the automated task gate under certain circumstances. This will be specific to your business rules and requirements to set up, but if you are repeatedly running into issues where you have lingering automated task gates, you may want to correct the root cause of this issue instead. Contact Orderwave Support if you have issues with automated tasks repeatedly leaving automated task gates in place.

# Concurrency

For basic Orderwave subscriptions, your automated tasks will not run concurrently; the automated task engine will run an automated task, and when it completes, it is free to run other scheduled tasks. For this reason, it is important to not create long-running tasks.

For higher tier subscription levels, your level of task concurrency correlates to the number of app workers that are deployed. Contact Orderwave Support for this exact number. Regardless, it is always recommended to space out the scheduling of your automated tasks so that they do not collide with each other.

# Long running tasks

With the flexibility of Rules Jobs, you have the potential to create long-running tasks (tasks that take a long time to complete). If your rules-job processes thousands of records, passing each one through a webhook that performs multiple actions, it is possible that the task could take a long time to complete. While the task is running, and with single concurrency, no other tasks will be invoked, and it is possible that certain mission-critical tasks will not be invoked at all (if your task runs too long, and the other scheduled task start-time is too far in the past).