# Enriching events with target and target value

*MuleSoft Developer Study Guide · Accessing and Modifying Mule Events · Last updated October 28, 2026 · https://www.certifyforce.com/study-guide/mulesoft-developer/accessing-and-modifying-mule-events/enriching-events-with-target-and-target-value*

How the Target and Target Value parameters on operations and Flow Reference store a result in a variable while the payload and attributes pass through unchanged, what the variable holds by default versus with `#[message]`, `#[attributes...]` or a selection, and how to read it later in DataWeave and in input parameters.

- Certification: Salesforce MuleSoft Developer
- Exam section: Accessing and Modifying Mule Events
- Study guide: https://www.certifyforce.com/study-guide/mulesoft-developer

**Official exam objective:**

> Apply correct processors/DataWeave expressions to enrich Mule events using Mule 4 connector targets, and predict outcomes.

## What the exam expects

- Identify which processors accept a Target (non-void operations such as HTTP Request, File Read and Database Select, and Flow Reference) and which do not (Logger, Set Payload, Remove Variable).
- Predict the payload, the attributes and the target variable after an operation or Flow Reference with a target.
- Choose a Target Value: the default `payload`, `#[message]`, `#[attributes.statusCode]` or a selection such as `#[payload[0].name]`, and write a valid target name.
- Read a target variable later: `vars.name`, `vars.name.payload` for a stored message, in a Transform Message or an operation's input parameters.
- Key terms: **Target** (`target`, name of the variable that stores the result); **Target Value** (`targetValue`, what to store, default `payload`); **enrichment** (adding data to the event without replacing the payload); **non-void operation** (an operation that returns a message).

## Key facts

| Fact | Detail | Source |
|---|---|---|
| Effect on the message | The next component receives the same message the operation received | [Enrich Data with Target Variables](https://docs.mulesoft.com/mule-runtime/latest/target-variables) |
| Target Value default | `payload` (the operation's result payload) | [Enrich Data with Target Variables](https://docs.mulesoft.com/mule-runtime/latest/target-variables) |
| Target Value keywords | `payload`, `attributes`, `message` allowed; `vars` not allowed | [Enrich Data with Target Variables](https://docs.mulesoft.com/mule-runtime/latest/target-variables) |
| Target names | Numbers, characters and underscores only; no hyphens | [Enrich Data with Target Variables](https://docs.mulesoft.com/mule-runtime/latest/target-variables) |
| Stored message | `targetValue="#[message]"`; read `vars.x.payload` and `vars.x.attributes` | [Enrich Data with Target Variables](https://docs.mulesoft.com/mule-runtime/latest/target-variables) |
| Other variables | Variables the operation changed revert after it finishes | [Enrich Data with Target Variables](https://docs.mulesoft.com/mule-runtime/latest/target-variables) |
| On error | Target variables are not set | [Enrich Data with Target Variables](https://docs.mulesoft.com/mule-runtime/latest/target-variables) |
| Flow Reference target | Target Value evaluates against the referenced flow's output; caller's message unchanged | [Flow Reference Component](https://docs.mulesoft.com/mule-runtime/latest/flowref-about) |
| Flow Reference, no target | Payload and variable changes in the referenced flow persist | [Flow Reference Component](https://docs.mulesoft.com/mule-runtime/latest/flowref-about) |
| `++` on objects | Combines the key-value pairs of both objects into one | [++ (DataWeave Core)](https://docs.mulesoft.com/dataweave/latest/dw-core-functions-plusplus) |

## Check yourself

- Why does a Database Bulk Insert with `target="bulkInsertResult"` leave the records as the payload?
- Why do a referenced flow's variable changes disappear when the Flow Reference has a target?
- What happens to changes a referenced flow makes to the payload or variables when the Flow Reference has no target?
- When are target variables not set?

## Sources

- [Enrich Data with Target Variables](https://docs.mulesoft.com/mule-runtime/latest/target-variables)
- [Flow Reference Component](https://docs.mulesoft.com/mule-runtime/latest/flowref-about)
- [Mule Event Structure](https://docs.mulesoft.com/mule-runtime/latest/about-mule-event)
- [Variables in Mule Apps](https://docs.mulesoft.com/mule-runtime/latest/about-mule-variables)
- [Set Variable Transformer](https://docs.mulesoft.com/mule-runtime/latest/variable-transformer-reference)
- [Query a Database Examples](https://docs.mulesoft.com/db-connector/latest/database-connector-select)
- [Mule Message Structure](https://docs.mulesoft.com/mule-runtime/latest/about-mule-message)
- [Core Components](https://docs.mulesoft.com/mule-runtime/latest/about-components)
- [++ (DataWeave Core)](https://docs.mulesoft.com/dataweave/latest/dw-core-functions-plusplus)

## About the full unit

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