Laminar
  • Laminar
  • Platform
    • Overview
    • Getting Started
    • Advanced
      • Configurations
      • HTTP Request Batching
      • Workflow Exit Points
      • Invoke Secondary Workflows
      • Managing Notifications
    • Best Practices
    • Keywords
      • lam.resolveThenExecute
      • lam.exit
      • lam.execute
      • lam.asyncExecute
      • lam.httpRequest
      • lam.httpRequests
  • Concepts
    • Workflows
      • Global Workflow Object
    • Flows
      • Flow Types
        • HTTP Request
        • Data Transformations
      • Flow Runs
      • Supported Languages
    • API Key
    • Configurations
    • API
      • Reference
        • Workspaces
          • Issues
          • Users
          • Invitations
            • Decline
            • Accept
            • Received
            • Created
          • Workflows
          • Flows
          • Auth credentials
          • Api keys
          • Api descriptions
        • Workflow
          • Execute
            • External
          • Flows
          • Executions
        • Users
        • Flows
          • Runs
          • Versions
          • Stats
          • Recent runs
          • Read
        • Configurations
          • Properties
          • Flow credentials
          • Workspace
        • Auth credentials
        • Api descriptions
        • Api keys
        • Transform
          • Test
        • Lami
          • Public
          • Direct
        • Auth
          • Signin
          • Register
          • Refresh
          • Me
          • Users
            • Password
    • Changelog
  • External Links
    • Book a Demo
    • Playground
    • Sign In
  • Specification
Powered by GitBook
On this page
  • Functionality
  • Invocation
  • Examples

Was this helpful?

  1. Platform
  2. Keywords

lam.asyncExecute

Learn more about the asyncExecute keyword

Functionality

The asyncExecute keyword executes each specified workflow in parallel. Unlike lam.execute, this keyword runs workflows asynchronously and does not block the current workflow's execution.

Invocation

Data transformation must output:

{
  "lam.asyncExecute": [
    {
      "lam.workflowId": 39,
      "lam.payload": { /* payload data */ }
    }
  ]
}
Key
Description
Type

asyncExecute

The workflows to execute with a payload

Array<{ workflowId, payload }>

workflowId

The workflow ID to invoke asynchronously

Integer

payload

The payload to pass to the workflow

Object

Examples

(payload) => {
  const { input } = payload;
  const { Recipient, PackagesInfo } = input;
  
  const packagePayloads = PackagesInfo.Packages.map(pkg => ({
    "lam.workflowId": 39,
    "lam.payload": {
      address_1: Recipient.Address1,
      address_2: Recipient.Address2,
      EXT_FIELD_first_name: Recipient.Firstname,
      EXT_FIELD_last_name: Recipient.Name,
      EXT_FIELD_email: Recipient.Email,
      EXT_FIELD_phone: Recipient.Tel,
      EXT_FIELD_weight: pkg.Weight.Value,
      custom_user_fields: [
        { order_custom_field_id: 1852 }
      ],
      address_city: Recipient.City,
      address_state_id: Recipient.CountryStateCode,
      address_country_id: Recipient.CountryCode,
      address_zip: Recipient.PostalCode,
      tracking_number: pkg.PreAssignTrackingNumber.TrackingNumber
    }
  }));

  return {
    "lam.asyncExecute": packagePayloads
  };
}

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.

Previouslam.executeNextlam.httpRequest

Last updated 1 month ago

Was this helpful?