Draft examples

The module used for the examples:

module

The source code for the module example.

The records used for the examples:

records

Fetching records

The compose records search function step allows you to search over the Low Code records. The two basic arguments module and namespace tell the workflow where we are fetching the records from. Further arguments are mainly to filter the data, and to control the size of it.

Regular fetch

By not specifying the query, all of the records are returned.

wf

The source code for the workflow example.

Simple filtering

If we want to filter over some field, such as a status flag, we define so in the query.

wf

The source code for the workflow example.

Date range filtering

If we want to filter between two dates, such as "users between year 2000 and 2020" and "is the current date between the start and end date fields".

wf

The source code for the workflow example.

Note the year(joined) >= 2000 AND year(joined) ⇐ 2010 query.

Filtering by "age"

This is how we can filter for data where a specific timestamp is "x amount of time old", such as "users wo have registered 30days ago" or "the contract will expire in 1 month".

wf

The source code for the workflow example.

Note the DATE(DATE_ADD(now(), INTERVAL 2 DAY)) = DATE(joined) query.

The above filter checks only the date (day) of the timestamp; so the number 30 from 2021-01-30T01:00:00Z. If you need more accuracy such as year and month as well, make sure to properly format the adjusted date

Iterators

You can use iterators to iterate over records, as well as using them as regular for and while loops.

Iterators define two control blocks — continue and break.

Both of the control blocks work as anywhere else; continue ends the current iteration and continues with the next one (if any), while the break ends the current iterator.

When you are nesting iterators, the control block only affects the deepest iterator relative to the control block.

Regular

The following example is a simple iterator that goes over all of the records. If you wish to apply filtering over what records you wish to pull, properly set the query argument (same as discussed with above fetching).

iterator wf

The source code for the workflow example.

Notice how the iterator is configured; primarily the results section where we specify under what variable the current record/index resides.

Nested

The following example is a simple iterator that goes over all of the records for module A, and then through all of the records for module B (in the example, in both iterators we use the same module, but you get the point).

If you wish to apply filtering over what records you wish to pull, properly set the query argument (same as discussed with above fetching).

iterator nested wf

The source code for the workflow example.

Notice how the iterator is configured; primarily the results section where we specify under what variable the current record/index resides.

Buttons

To add a button to a page, you need to:
  1. Define a workflow with an onManual event type,

  2. add a button to the automation page block.

Defining the workflow

manual wf

The source code for the workflow example.

Make sure to use the appropriate resource on the trigger based on where you wish to show it. If you wish to show it somewhere in the namespace, uwe the Compose Namespace resource, on a page Compose Page, on a record page Compose Record and so on.

Based on what resource you select, the workflow may receive additional context, such as what record you’ve pressed the button on.

If it doesn’t matter, just use Compose as the resource.

Adding it to a page

Open the page block builder and add a new automation page block (you can reuse existing automation page blocks and append the new workflow).

pageblock automation add

Using it

Open up the page the button resides on and click it.

pageblock automation pressed