Scheduled Tasks

In this article, we will provide you with a comprehensive understanding of how to schedule tasks in Knack.

This article covers the following topic:

 

Overview

Tasks are automated actions that can be applied to a specified set of records on a scheduled basis (daily/weekly/monthly). These actions can enhance the workflow of your app, such as sending friendly reminders when a deadline is approaching or automatically adding important to-do records periodically.

To access tasks, navigate to the Tasks section in the Builder and set them up for a specific table. Tasks are triggered by field values for records within that table.

For example, if you want to create a task that sends an email to the project manager when the due date for their project has passed, you can easily set up the task in the "Projects" table.

Note: Tasks can be accessed with a Pro plan or higher. They are automatically enabled when you upgrade to a plan that includes tasks.

For more information, please visit our pricing page.

 

Managing Tasks

You can find Scheduled Tasks in the Tasks section of the Builder. From this section, you have the option to add, edit, or delete tasks for any of your existing tables.

Adding Tasks

To add a new task, simply click on the Tasks view located on the top menu after you have selected a table. Then, select the "+ Add a task" button.

This will open a popup modal that will guide you in defining your task and the actions it will perform:

tasks1tasks2

Tip: You can learn about the customization options available in the Task Settings section below.

 

Viewing Tasks

You can easily view the current tasks on an app from both the Dashboard and the Builder.

In the Dashboard, you can view a summary of tasks on each app in the app details:

scheduledtasks3

Selecting this option will give you a quick overview of how many active and paused tasks are in that app:

scheduledtasks6

In the Builder, tasks can be viewed by clicking on the "Tasks" option from the top menu when viewing a table, or by selecting "Tasks" from the left-side 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:

tasks5

Pausing 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, you can change its Status:

tasks6

Deleting a Task

To delete a task, simply click on the ellipses icon to the right of the task's name and choose "Delete" from the dropdown menu. You will be prompted to confirm the task deletion before it is permanently removed.

tasks7

Task Settings

Task

Every task needs some essential information to identify it and determine its schedule and frequency of execution. We'll go over each setting in this section and what it entails. 

tasks8

  • Task Name: Choose a descriptive name for your task to easily identify its purpose. For instance, you can name an email task that sends a reminder three days before a deadline as "Upcoming Deadline - Email."

  • Schedule: You can choose the frequency of your scheduled task. Scheduled tasks can be set to run daily, weekly, or monthly.

  • Next Run Date: The Next Run Date field is updated every time the task runs, indicating the next scheduled time for the task.

  • Status: You can select whether the task is running or paused. This feature is useful when you want to save a task for future use.

Note: Currently, yearly scheduled tasks are not available.

 

Action

Each time the task is executed, it will perform a specific action. The task has the capability to perform the following actions:

  • Update each record

  • Update connected records

  • Insert connected records

  • Send a custom email

tasks9


Let's go over each of these options below:

 

Update This Record

For the "Update this record" option, the task will update every record in this table that meets your criteria, if you choose to include criteria. Otherwise, the tasks will run on every record.

The task shown below 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":

tasks10

Update Connected Records

You can use this action when you need to update records in a connected table.

When the task below comes across a record in the Registration table where the "Status" field value is "Paid", it will proceed to update each connected member and change their user status to "active":

tasks11

Insert a Connected Record

This action will insert a record into another connected table.

The task below will automatically insert a connected purchase record for a product when the inventory level reaches the minimum threshold. The task utilizes a field value from each product to determine the supplier and date to reorder:

tasks12

Note: In the example above, no value was set for the Product connection. However, Knack will automatically populate this value since it is inserting a connected record from the Product table.

 

Send a Custom Email

With this option, 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.

Using values from the product record, this task will notify the purchasing department which products have low inventory and need to be replenished:

tasks13

 

Tip:  To learn more about sending emails in Knack, see our article here

 

When - Filter the Records

By default, all of these actions will apply to all records. However, if you want to target a specific set of records, you can add criteria to the task.

All rules added here must be met, as they are treated as "and" rules.

In this example, it's targeting records that have the supplier set as "CDW" and the product set as "Cisco Router - 10x":

tasks14

Values - Set the Record Values

Once you have chosen an action and added criteria, it is important to specify the values that the task will update or insert. You have a variety of value options to choose from, including:

  • 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 the values selected in the action when the action is triggered.

      • By adding: This option allows you to add the selected value(s) to any existing values in the field when the action is triggered.

      • By removing: If the value selected in the action exists in the field when the action is triggered, this option will remove it.

  • to a field value:  This option will update the field by using the value from another field.

  • to a connected value: This option will update a field value by using a value found in a connected record from a one-to-one/one-to-many relationship.

  • to the current date: This is only available with Date/Time fields. This option sets the value of the field to the current date and time. 

Note: If you are unable to see the option labeled "to a connected value," please make sure to review your connections. It is important to note that you will not be able to access connected records using many-to-many or many-to-one connections.

To learn more about connection types, see our article here.

 

Task History

The "History" tab provides a comprehensive record of the task's activities over time. It displays a timestamped list of each instance when the task was executed, along with the number of records that were processed.

If the task was manually executed, it will be indicated in the status (see image below).

If the task is set up to send an email, you have the option to access the history of emails sent from the task by clicking on "View email delivery history".

tasks15

 

Running a Task Manually

If you ever need to run a specific task without disrupting its regular schedule, you can conveniently use the "Run" tab in the task to manually execute it.

Upon initiating the task, you will receive a notification indicating that the task is currently in progress. To verify the completion status of the task, refer to the History tab.

tasks16

tasks17

 

Using Tasks in Your App

Workflow & Automation

Scheduled tasks are an incredibly valuable tool for automating processes and streamlining workflow. Let's explore a few different ways you can leverage this powerful feature:

In a Project Management App

Configure a task in the Tasks table to automatically send an email to the connected project manager when a deadline is nearing and the status is incomplete.

Tip:  Check out our Project Management sample app.

For an Approvals Process

For this example, let’s assume a proposal has to go through three level of approvals.

Utilize date fields and record rules to effectively monitor the approval progress of each assigned approver for the proposal record, and automatically update the current approver connection field with the subsequent person in the approval sequence.

Create a task in the Proposal table to send an email to the current approver if a proposal record has been at their approval level for more than 3 days without being approved or denied.

Layer Tasks

An effective way to avoid overwhelming actions is by implementing layered tasks. Let's consider an example from an HR app.

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 document records inserted.

Automation & Layering

An inventory app is a good example of combining the uses we explain in the sections above.

First, set up a task to check product records on a daily basis - when the "Quantity Remaining" field value is below a certain threshold, set the "Needs Reorder" field 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".

Tip:  Check out our Inventory Manager sample app.

 

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 has the capability to run up to 200 simultaneous scheduled jobs, including tasks, at any given time. These jobs can originate from any app, which may include those from other customers.

Note: If your task gets queued for either of the above concurrency limits, the scheduled order is no longer applicable. Please do reach out to our support team via the chat widget in the Builder or by submitting this form if you notice that your tasks are running behind schedule or experiencing any issues with their order.

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"

Please make sure to double-check your connections as you will not be able to access connected records using many-to-many or many-to-one connections.

I'm not seeing the “Tasks” tab in my table menu

Users who are on trial or Starter plans do not have access to scheduled tasks. To access tasks, you will need to upgrade to the Pro plan or a higher plan.

Tip: To view our plans and pricing, see this page here

How do I control the order in which my tasks run?

Tasks are not executed in a specific order. Therefore, if you have two tasks that start simultaneously, they will run concurrently. If you want tasks to be executed sequentially, you will need to schedule them at different times.

It is generally recommended to space out the tasks depending on the number of records you are dealing with. We suggest a spacing of approximately 30 minutes to 2 hours, but if you have a large number of records being updated, you may need to allow for more time.

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.

How-To Guides