Skip to content

Dataport Script Reference: Loop Scope

When a Call Function node runs inside a Loop node, these additional context properties are available.

context.item

The current array item being iterated.

Type: any

Example:

js
// Inside a loop over an array of users
context.log(context.item.name) // 'Alice'

context.iterationId

A unique ID for the current iteration.

Type: string

context.iteratorActivityId

The activity ID of the Loop node that triggered this iteration.

Type: string

context.iterationContext

The full iteration context object. Contains all loop-related metadata.

Type:

js
Object {
  iteratorId: string,
  iteratorActivityId: string,
  iterationId: string,
  item: any,
  index: number,
  array: any[],
  callback: () => void,
}

Example:

js
context.log(`Item ${context.iterationContext.index + 1} of ${context.iterationContext.array.length}`)

context.iterationCallback

A function that signals the loop that the current iteration is complete. Called automatically when the script returns — only use this if you need manual control.

Type: () => void