Scheduled Tasks
The ability to automate your everyday business tasks is one of the most essential features of database applications. With automated tasks, you can trigger automated workflows to run upon custom-defined conditions at scheduled times or on-demand, automating your daily business processes and eliminating tedious, repetitive labor and manual error.
What are tasks?
Tasks refer to a custom-defined set of actions with conditions that you can trigger to run automatically on a custom schedule or on-demand.
Examples of tasks that you can automate include:
- Sending an automated email on the first of each month to all your active customers with their total balance due
- Sending automatic alerts to employees with outstanding tasks reminding them of their upcoming deadlines
- Sending an automated email to the respective manufacturer when a product reaches a custom-defined minimum inventory
How tasks are processed
Each task is associated with a specific data table. When creating a new task, it is important to first correctly determine within which data table you will create the task. In general, you want to create the task within the data table that you want the task to loop through.
Example: Say you have a rental management business and you want to create a new task to automatically generate a new invoice on the 23rd of each month for each of your active leases.
Question: When creating this task, would you create the task within the Invoices data table or within the Leases data table?
Answer: You would create the task within the Leases data table. This is because you want to create the task within the data table that you want the task to loop through, and even though the task is to create a new invoice, the task will look through all the records within the Leases data table to find those that match the conditions of your task and run your desired action (task) upon those records.
Another easy way to determine within which data table you should create the task is by noting the data table that follows the term "for each". For instance, your task will create a new invoice for each active lease.
Creating a Task
To create a new task, select the Automation tab, Scheduled Tasks, and then click on the Create a New Scheduled Task button.
Creating a task consists of four steps:
Let's walk through each of these four steps below.
1. Choose interval
First, define the name, Data Table, and interval of when your new task should run. For instance, "Generate a monthly bill and run Monthly at 08:21 AM starting from 05/17/2020"
Once you've determined the interval and starting date/time, you can now create the task action within the following step.
2. Choose an action
There are currently 6 types of actions that can be automated using a task:
- Update this record
- Update connected records
- Insert connected records
- Insert new records
- Send email
- Send Text/SMS
Please Note: Not all actions are available in all scenarios. Certain actions such as Update connected records or Insert connected records are only available if there are specific connection conditions met.
Let's explore each of the six action types that can be automated with tasks.
1. Update this record
Update this record will cycle through all the records and update specific fields to values that you have predefined.
Task Example: Every day at 8:00 AM update each record with a balance higher than 0 and set status to "Past Due"
2. Update connected records
Update connected records will look through all records in the data table and for each record that matches your task conditions will update all the connected records of that data table to the predefined values.
Task Example: Every day at 5:00 AM look through all the bills that are overdue and set the connected user's status to "Inactive"
3. Insert connected records
Insert connected records will insert a new connected record for each record within this data table.
Task Example: On the 23rd of each month create a new bill for each lease with a lease status of "Active."
4. Insert new records
Insert new records will insert a new record that is not (necessarily) connected to this data table.
Task Example: Every Monday at midnight insert a new record in the logs data table with the status of all current leases.
5. Send Email
Send Email will send an email for each record in the database that matches your custom-defined task conditions.
Task Example: Send a daily email to each customer reminding them if they have a job scheduled for that day.
6. Send Text/SMS
Send Text/SMS will send a text message for each record in the database that matches your custom-defined task conditions.
Task Example: Send a daily text message to each customer that has a job and has opted for SMS notifications.
Task action example
Now that we have identified each of the six task action types, let's look at a sample task action below. As you can see in the image below, this sample task has the action of Inserting a connected record of a bill for each lease whenever the lease status is Active:
The "when the status is active" section of the task that follows the action is called the task condition and is step three of creating new tasks.
3. Choose conditions
As demonstrated in the example above, you can attach conditions to task actions to filter which records your task should be processed against. For instance, "when the status is active":
You can add multiple conditions that will work together. For instance, if "Status is Active" and "Created At is during the last 30 days". To add additional conditions/filters, click on the + icon on the right and simply add another condition(s).
4. Set field values
For the fourth and final step of creating a new task, you must set the fields and field values to be used when the task runs.
For instance, if your task action is Send Email, you will now need to set the specific details you wish to accompany your task when it runs, such as the email address, subject, and message body. This step is where you will set the fields of email address, subject, and message body to your desired values.
As another example, let's use the same example we used above with the action and condition of inserting a connected record of a bill for each lease that has a status of active:
For this example, the fields and field values have been set to run as follows when the task is run:
Please Note: When setting the values, the options available are dependent on the field type and the structure of your specific data table.
Running Tasks
Tasks can be triggered via three different ways:
- Scheduled tasks
- On Demand tasks
- Via a component
Scheduled tasks
With scheduled tasks, you can schedule your tasks to run at custom-defined intervals and on a recurring, scheduled basis.
The date and time this task will run is based on the timezone you have configured in your app. If your app has the default timezone of UTC and you set a task to run at 12:00 AM daily, it will be 12:00 AM UTC. Changing your timezone will not impact when the task runs until you re-save the task again.
On Demand tasks
You can choose to run tasks on demand as well. For instance, the purpose of testing your task, you can run a task directly from within the builder while editing a task. You can do this by clicking the Run Task button at the top right-hand side of the task edit page.
Tasks must first be saved before the task can be run. Making any changes to the task will remove the Run Task option until you save again.
Via Components
You can also choose to run tasks using a Task Data Component. The task data component enables you to add a button which, when pressed, will trigger your task.
This has the benefit of enabling you to run the task on a subset of users when adding this component to a details page and choosing the right options. Please see the Tasks Component article for more details (coming soon).
Reviewing Tasks
Within each task, you can view the log history of the task including the start time, end time, status, records processed, task type, as well as from where the task was triggered. To view the history of any task, simply click on the History tab inside the task to see the logs.
Task allowances
Please note that not all Tadabase plans include the ability to automate tasks. Please see your subscriptions page or the Tadabase pricing page to see if your plan allows for tasks.
Additionally, each plan has unique limitations as to how long each task can run for:
-
- Plus: 5 Minutes (generally about 100,000 minor record updates, or 5000 complex updates)
- Pro: 10 Minutes
- Premium: 15 Minutes
- Bronze: 20 Minutes
- Enterprise: 1 Hour
Shortest intervals is Daily on all plans except for Enterprise. Enterprise plans have additional options including Hourly and custom Interval (as low as every 5 minutes).
We'd love to hear your feedback.