Skip to main content

Introduction to tasks

Tasks are a powerful feature of Bobuild, that let you create automated workflows without programming. They can be used to perform a variety of operations, such as:

  • Sending emails to one or more records
  • Attaching files from record fields
  • Updating values
  • Calculating formulas
  • Performing checks and raising form validation errors
  • Running a SQL command
  • Advancing a workflow
  • Generating documents
  • Creating new records
  • Deleting records

Tasks can be configured in several contexts. According to the context, they will run on one single record or will run on multiple records.

ContextRecordsDescription
FormSingleTask will be executed at form submission.
StepperSingleTask will be executed when the user clicks a step (clickable mode).
GridMultipleUsers will be able to select one or more records with checkboxes and run a task on multiple records at once.
API endpointSingle/MultipleTask will be executed whenever the endpoint is called.
Batch taskMultipleTask can be run manually to perform batch updates.
Scheduled taskMultipleTask will be run automatically according to a schedule.

Anatomy of a task​

The interface to configure a task differs based on whether it's running on a single record (such as form tasks) or whether it's running on multiple records (such as grid or batch tasks) as things can get a bit more complex in the second case but definitely very powerful. However, in general a task has:

  • a set of conditions under which the task will be executed or not
  • one or more actions to run

Actions are evaluated sequentially. If a condition doesn't match, evaluation doesn't stop and the next action will be evaluated.

For tasks that run on multiple records, all the actions are repeated for all the input records. This will be the sequence:

  1. Record #1
    1. Action #1 is processed on record #1
    2. Action #2 is processed on record #1
    3. Action #3 is processed on record #1
  2. Record #2
    1. Action #1 is processed on record #2
    2. Action #2 is processed on record #2
    3. Action #3 is processed on record #2

However, if you don't want to repeat an action for all the records you can decide to run it only for the first one or the last one. For instance:

  1. Record #1
    1. Action #1 is processed only on the first record
    2. Action #2 is processed on record #1
    3. Action #3 is processed on record #1
  2. Record #2
    1. Action #2 is processed on record #2
    2. Action #3 is processed on record #2
Example

Let's see a complex example. Suppose you want to let the user select multiple products from a list and then click a button to generate an invoice. For this, you'll create a grid with the product list, and configure a task on this grid that performs the following actions:

  • Action #1: create a new object of type invoice and attach it to the current customer (to be run only on the first record)
  • Action #2: attach the currently processed record to the last created invoice (to be run on all records)
  • Action #3: send a notification e-mail to the team (to be run only on the last record)

Creating a task​

We'll now see how to create a task at the object level, but the procedure is the same for any other place where tasks are supported. So, open the object you want to run the task on and click the Tasks button:

Example

Now click on the Add task button and your task will be created:

Now, give your task a name, then set conditions to define which records will be affected by the task, and finally set one or more actions to perform on the selected records.

Example

Suppose you want to send a reminder e-mail to all customers who owe you money:

Running, stopping, and performance​

Object (batch) tasks show progress while they run. Use Stop to cancel a running job — Bobuild marks the run as stop-requested and cancels the in-flight database work when possible, instead of only waiting politely between records.

The task preview estimates performance impact: how many automatic fields a write may refresh and roughly how large those cascades are (including creates/deletes). App Health also flags heavy cascades. For bulk runs that do not need mid-run auto values, enable Defer auto field calculation at the end of task execution (Advanced on the object task): writes stay fast, then Bobuild recalculates automatic fields once from everything the task wrote. Use defer only on tasks that touch many records — on small runs it can be counterproductive. Mid-task actions must not rely on auto fields that would have changed during the run.

Next steps​