lam.asyncExecute

Learn more about the asyncExecute keyword

Invocation

Data transformation for a flow must output:

{ 
 "lam.asyncExecute": [
  {
    "lam.workflowId": Integer,
    "lam.payload": { ... }
  }
 ]
}
Key
Description
Type

asyncExecute

The workflows to execute asynchronously with a payload.

Array { lam.workflowId, lam.payload }

workflowId

The workflow ID to invoke asynchronously.

Integer

payload

The payload to pass the workflow we're invoking.

Object

Functionality

The asyncExecute keyword will execute each specified workflow in thelam.ayncExecute array with its corresponding payload. This keyword allows for iterative operations (i.e. running a POST request for various objects in a list) that should be run asynchronously and will not block the current running workflow's execution.

Examples

.input |
.Recipient as $rcp |
.PackagesInfo.Packages as $pkgsInfo |
{
  "lam.asyncExecute": $pkgsInfo | to_entries | map({
    address_1: $rcp.Address1,
    address_2: $rcp.Address2,
    EXT_FIELD_first_name: $rcp.Firstname,
    EXT_FIELD_last_name: $rcp.Name,
    EXT_FIELD_email: $rcp.Email,
    EXT_FIELD_phone: $rcp.Tel,
    EXT_FIELD_weight: .value.Weight.Value,
    custom_user_fields: [
      {
        order_custom_field_id: 1852,
      }
    ],
    address_city: $rcp.City,
    address_state_id: $rcp.CountryStateCode,
    address_country_id: $rcp.CountryCode,
    address_zip: $rcp.PostalCode,
    tracking_number: .value.PreAssignTrackingNumber.TrackingNumber
  }) | map({
    "lam.workflowId": 39,
    "lam.payload": .
  })
}

In this example we map an array of packages to the asyncExecute keyword. Laminar will then invoke workflow 39 with each individual payload in parallel.

Last updated