# Calling flows with the DataWeave lookup function

*MuleSoft Developer Study Guide · Transforming Data · Last updated October 28, 2026 · https://www.certifyforce.com/study-guide/mulesoft-developer/transforming-data/calling-flows-with-the-dataweave-lookup-function*

How `lookup(flowName, payload, timeoutMillis)` runs a flow from a DataWeave script: it calls flows but not subflows, passes and returns only a payload, times out after 2000 ms on CPU_LIGHT or CPU_INTENSIVE threads, and must not have side effects, which is why MuleSoft recommends a Flow Reference with a target variable instead.

- Certification: Salesforce MuleSoft Developer
- Exam section: Transforming Data
- Study guide: https://www.certifyforce.com/study-guide/mulesoft-developer

**Official exam objective:**

> Call Mule flows from a DataWeave script.

## What the exam expects

- Write a `lookup` call that runs a flow from a DataWeave script and predict the value it returns.
- Recognise that `lookup` cannot call a subflow, and that it passes and returns only a payload.
- Apply the `timeoutMillis` default and know that exceeding it raises an error.
- Recommend a Flow Reference with a `target` variable when the called flow has side effects or is called per item.
- Key terms: **lookup** (dw::Mule function that executes a flow by name and returns its payload); **dw::Mule** (DataWeave module of functions that interact with the Mule runtime); **Flow Reference** (component that routes the whole event to a flow or subflow and back); **target variable** (Flow Reference setting that stores the result in a variable and leaves the message unchanged); **side effect** (an action such as writing a record that changes something outside the returned value).

## Key facts

| Fact | Detail | Source |
|---|---|---|
| Signature | `lookup(flowName: String, payload: Any, timeoutMillis: Number = 2000)` | [lookup](https://docs.mulesoft.com/dataweave/latest/dw-mule-functions-lookup) |
| Module | `dw::Mule`, with `causedBy` and `p` | [Mule (dw::Mule)](https://docs.mulesoft.com/dataweave/latest/dw-mule) |
| Minimum runtime | Mule 4.1.4 and later | [lookup](https://docs.mulesoft.com/dataweave/latest/dw-mule-functions-lookup) |
| Subflows | `lookup` does not support calling subflows | [lookup](https://docs.mulesoft.com/dataweave/latest/dw-mule-functions-lookup) |
| Input | Only the payload, no attributes or variables | [lookup](https://docs.mulesoft.com/dataweave/latest/dw-mule-functions-lookup) |
| Output | Only the called flow's payload | [lookup](https://docs.mulesoft.com/dataweave/latest/dw-mule-functions-lookup) |
| Timeout default | 2000 ms on CPU_LIGHT or CPU_INTENSIVE threads, 1 minute otherwise; exceeding it raises an error | [lookup](https://docs.mulesoft.com/dataweave/latest/dw-mule-functions-lookup) |
| Status | Deprecated; Flow Reference with `target` is recommended | [lookup](https://docs.mulesoft.com/dataweave/latest/dw-mule-functions-lookup) |
| Flow Reference reach | Routes the event to a flow or a subflow | [Flow Reference Component](https://docs.mulesoft.com/mule-runtime/latest/flowref-about) |

## Check yourself

- When does `lookup` raise a timeout error on a CPU_LIGHT thread if no `timeoutMillis` is given?
- When do the payload and variable changes made in a referenced flow persist after a Flow Reference?
- What does the documented `Mule::lookup('flow2', {test:'hello '})` return to `flow1`'s script?
- Which minimum Mule runtime version supports `lookup`?

## Sources

- [lookup](https://docs.mulesoft.com/dataweave/latest/dw-mule-functions-lookup)
- [Mule (dw::Mule)](https://docs.mulesoft.com/dataweave/latest/dw-mule)
- [Flow Reference Component](https://docs.mulesoft.com/mule-runtime/latest/flowref-about)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 3 linked practice questions, and unlimited timed mock exams are included with the MuleSoft Developer pack (USD $19): https://www.certifyforce.com/practice-exams
