# lam.resolveThenExecute

## Functionality

The `resolveThenExecute` keyword resolves a pending request with the contents from `lam.result` and then executes a new workflow. This enables asynchronous workflow execution by immediately responding to webhook requests while continuing processing.

## Invocation

Data transformation must output:

```javascript
{
  "lam.resolveThenExecute": {
    "lam.workflowId": 52,
    "lam.payload": { /* payload data */ },
    "lam.result": { /* result data */ }
  }
}
```

| Key        | Description                                               | Type    |
| ---------- | --------------------------------------------------------- | ------- |
| workflowId | The workflow ID to invoke after resolving pending request | Integer |
| payload    | The payload to pass to the workflow                       | Object  |
| result     | The result to resolve the pending request with            | Object  |

## Examples

```javascript
(payload) => {
  const { step_2, input } = payload;
  const { Recipient, PackagesInfo } = input;
  
  const packages = PackagesInfo.Packages.map(pkg => ({
    address_1: Recipient.Address1,
    address_2: Recipient.Address2,
    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.resolveThenExecute": {
      "lam.workflowId": 52,
      "lam.payload": {
        "packages": packages
      },
      "lam.result": step_2.data
    }
  };
}
```

> In this example we start workflow 52 with our packages array and resolve the pending request with our $result.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.laminar.run/building-an-integration/keywords/lam.resolvethenexecute.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
