Skip to main content

Loop batch block

The Loop batch block will loop over all items in a list, and provide them in batch. This block is used to process a large list of items in batches, e.g. to send them in batch to a destination.

Note: the Loop block will also loop over items in a list, but inside the loop only a single item at a time will be processed.

Example configuration of the Loop batch block:

Configuring the Loop Batch block.

an automation consisting of a start block, a List Contacts block, and a Loop Batch block. The Loop Batch block is selected. Loop over items of list is set to List Contacts, and Amount of items per batch is set to 1000.

Example usage of the Loop batch block:

The Loop Batch block in use.

As above, with the addition of a loop containing an Output block. The Output block is selected. The Data to output is set to Loop Batch > Batch.

The batch available inside the loop is a list (array) of items. So in the above example, the Output would be a list of 1000 contacts from Hubspot for each iteration of the loop.

Here's an example of using a Transform list block block inside the loop, to transform the items in the batch to a new format, before sending it to a destination:

Using the Transform List block.

an automation consisting of a Start block, a List Records block, and a Loop Batch block containing a Transform List block and an Add Logs block in its loop. The Transform List block is selected. The Input list is set to Loop Batch > Batch, and under the status dropdown Field is set to status and Value is set to Transform List > Item> Status.

Here's the same example in raw view:

Using the Transform List block, with raw code..

As above, but in raw code.

Instead of using Transform List, you can also use variables. This gives you more freedom to apply logic on each individual field of an item. Create a variable of type list, e.g. logs in the example below, and create a variable of type object, e.g. log in the example below.

Inside the batch, make the list empty. Next, create the objects one by one and add them to the list. Finally, send the new batch (list variable) to a destination:

Using variables in an automation.

an automation consisting of a List Records block and a Loop Batch block. Inside the Loop Batch block's loop are a Variable: Logs block, a Loop block, and an Add Logs block. Inside the Loop block's loop are a Variable: Log block and a Variable: Logs block.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!