Table of Contents
Updated by Lesley
What are Scheduled Tasks?
Tasks are automated actions that can be applied to a defined set of records on a scheduled basis (daily/weekly/monthly). These actions can drive your app’s workflow in powerful ways, such as sending automatic reminders when a deadline is coming up or automatically adding your to-do records periodically.
Tasks are accessed in the Tasks section of the Builder and set up for a table. They are triggered by field values for records in the table in which the task is set up. For example, if you want to set up a task to email a project manager when a due date for their Project has passed, you’ll set up the task in the Projects table.
Scheduled Tasks are located in the Tasks section of the Builder. From this section you can select any of your existing tables to add, edit or delete tasks.
Add a new task by clicking on the Task option on the left-side of the Builder, then select the table you would like to add your task(s) to. This will open a popup modal prompting your to define your task and the actions it will run.
You can see all the customization options in the Task Settings section below.
Current tasks on an app can be viewed from both the Dashboard and the Builder.
In the Dashboard, you can view a summary of tasks on each app in the app details:
Hovering over this number will give you a quick overview of how many active and paused tasks are in that app. Similarly clicking on the task number will open a popup modal showing with the summary:
In the Builder, tasks can be viewed by clicking on the ‘Tasks’ option on the left-side of the Builder and then selecting a table from the top menu. Here you will be able to see your task details as well as create and edit tasks:
You can also view a count of how many tasks are set up in each table next to the table's name:
Pause a Task
If you want to stop using your task for the time being, you don't have to delete it entirely. To pause an existing task indeterminately, change its Status setting to "Off."
You can quickly see if a task is paused directly from the task list.
Delete a Task
To delete, click on the gear-shaped icon on the field and select 'Delete' from the dropdown menu. You will need to confirm the task deletion before it is complete.
Each task requires some basic info to identify and tell it when and how often to run.
- Task Name: Give your task a specific name to help you remember what it does. For example, an email task to be sent out 3 days before an approaching deadline may be named “Upcoming Deadline - Email.”
- Schedule: The frequency of your scheduled task. Scheduled tasks can run on a daily, weekly, or monthly basis.
- Next Run Date: When the task is scheduled to run. This field updates every time your task runs to reflect the next scheduled time.
- Status: Whether the task is On or Off. This is useful for when you want to save a task for later use.
Actions - Define What Your Task Will Do
Every time your task runs, it’s going to perform a specific action. Your task can perform the following actions:
- Update each record
- Update connected records
- Insert connected records
- Send a custom email
Update each record
The task is going to update each record in this table matching your criteria.
This task looks at every record in the Products table. When the task finds a record whose Inventory on Hand field value is lower than 10, it will update that record’s Available field value to "No."
Updated connected record
Use this action when you want to update records in connected table.
This task looks at every record in the Companies table. When the task finds a record where the Active? value is "No," it is going to update every connected User and set their user status to ‘inactive’
Insert connected records
This action inserts a record in another connected table.
This task will automatically insert a connected Purchase record for a Product when their inventory level reaches the minimum threshold. The task uses a field value from each Product to know how many to reorder.
Send a custom email
For every record that meets the criteria in this table, Knack will send a custom email. You can use record values for custom recipients, subjects, and messages. Click here to learn more about sending emails in Knack.
Using values from the Products record, this task will notify the purchasing department which Products have low inventory and need to be replenished.
When - Filter the Records
All of these actions affect all records by default. Add criteria to the task if you want to target a specific set of records.
Rules added here are treated as AND rules, meaning all rules must be met.
In this example target records when the Supplier is "CDW", AND the Product “Cisco Router - 10x”:
Values - Set the Record Values
Now that you’ve selected an action and added criteria, it’s time to tell the task what values it is going to update or insert. Value options available include:
- to a custom value: This allows you to either:
- Enter a value manually.
- Or you can append or remove values for multiple choice fields or connection fields without overwriting the existing values. (see below)
- By replacing with: this option will replace the current field value with whatever values are selected in the action when the action triggered.
- By adding: this option will append the value(s) selected in the action to any existing values in the field when the action is triggered.
- By removing: this option will remove the value selected in the action if it exists in the field when the action is triggered.
- to a field value: Update the field using the value from another field
- to a connected value: Update a field value to using a value located in a connected record from a one-to-one/one-to-many relationship
- to the current date: Only available with Date/Time fields. Sets the value of the field to the current date and time.
This example will update the status of an Order Item using its parent Order’s status
The “History” tab helps you keep track of what your task has done over time. It shows you a timestamped list of all the times this task has run, and how many records were processed.
If the task was run manually, it will say so next to the timestamp.
If the task is configured to send an email, you can view the history of email sent from the task by clicking on “View Mail Delivery History.”
Run a Task Manually
You may find it useful to run a specific task without wanting to take it off its regular schedule. In this case, you can use the “Run” tab in a task to run it manually. You'll see a confirmation message that your task is currently running. You can use the “History” to confirm whether the task has completed or not.
Use Tasks in Your App
Workflow & Automation
Scheduled tasks are a powerful tool for automating processes and enabling workflow. Let’s take a look at a couple different ways you can do this.
In a project management app
Set up a task in the Tasks table to automatically email the connected Project Manager when a deadline is approaching and the status is incomplete.
For an approvals process
For this example, let’s assume a Proposal has to go through three level of approvals.
Use date fields and record rules to track when each assigned approver has approved the Proposal record and update the Current Approver connection field with the next person in line.
Set up a task from the Proposal table to email the current approver when a Proposal record has been at their approval level for more than 3 days and has still not been approved or denied.
You can layer tasks to prevent too many actions from occurring. Let’s use an HR app for example.
When a new employee is added to the database, HR wants to assign a series of Document records to the employee so the employee can upload their information. HR will set up a task to automatically insert new Document records to the employee.
In order to prevent new Document records from being assigned to every single Employee record, there needs to be a way to recognize when an Employee has already been assigned the records.
Set up another task following the original task that sets a Documents Assigned field value in the Employee record to Yes. Make sure this task runs after the original task runs. For example, the original task may run at 9am every morning, this new task will run at 10am every morning.
Then, use a when filter on the original task to filter out Employee records where the Documents Assigned field value is No. This way, only the newly added Employees will have new connected Documents records inserted.
Automation & Layering
An inventory app is a good example of combining the uses we explain above.
First, set up a task to check Product records on a daily basis - when the Quantity Remaining value is below a certain threshold, set the Needs Reorder value to Yes. Set up another task that checks the Quantity Remaining value - when it’s above the threshold set the Needs Reorder value to No.
Set up another task following the first one that automatically inserts a connected Purchase Order record when the Product’s Needs Reorder value is Yes.
The final task in this workflow is set up in the Purchase Orders table to email the purchasing department 3 days after a Purchase Order has been created if the status of the Purchase Order is still pending.
Notes & Troubleshooting
How many tasks can run at the same time?
Each app can run 4 simultaneous scheduled jobs (including tasks) at one time. If your app has more than 4 jobs scheduled to run at the same time, they'll be queued up to run next as soon as another task finishes running. Each Knack shared server can run 14 simultaneous scheduled jobs (including tasks) at one time. These jobs can come from any app, which may be from other customers.
Note that if your task gets queued for either of the above concurrency limits, the scheduled order is no longer applicable. Please do reach out to email@example.com if you see that your tasks are running late or out of order so we can look into it for you.
The only way to lift this limit is with an enterprise plan that includes a private server. Please reach out to us using the form on that page for more information.
I'm not seeing the option labeled to a connected value.
Double-check your connections -- you will not be able to access connected record using many-to-many or many-to-one connections.
I'm not seeing the “Tasks” tab in my table menu.
Users on trial and Starter plans do not have access to scheduled tasks. You need to be on the Pro plan or above to access tasks.
How do I control the order in which my tasks run?
Tasks don't run in any specific order. So if you had two tasks start at the same time, they'll run at the same time. If you want tasks to run sequentially you have to time your tasks apart. Depending on how many records you're dealing with, we usually suggest spacing them about anywhere between 30 minutes - 2 hours, but you may need to leave more time if you have a lot of records being updated.
Will removing a task cancel the currently running instance of that task?
No, if the task is running it will complete even if you delete the task.