---
schema_version: "1"
id: 8784c50b049c64fd6e68074b81c71a440a96816dac14b8d1b83e8585f58752d8
title: Variables in Mule Apps
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/mule-runtime/4.4/about-mule-variables.md
canonical_url: https://docs.mulesoft.com/mule-runtime/4.4/about-mule-variables
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 66ea0d76c4d4b1a9255904d1f9009bbf9dffeb7980714d49c8fd357f66c368f8
description: MuleSoft Documentation Site
release: "4.4"
latest: false
---
---
product: Mule Runtime
version: 4.4
---

# Variables in Mule Apps

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Variables are used to store per-event values for use within a flow of a Mule app. The stored data
can be any supported data type, such as an object, number, or string. It is also possible to store
the current message (using the `message` keyword), the current message payload (using the `payload`
keyword) or just the current message attributes (using the `attributes` keyword). You can even use a
DataWeave expression as the value. However, the keyword `vars` (for example, `vars.someOtherVar`) is
not allowed.

You can create, or update, variables in these ways:

- Using the Set Variable component.

- Using a Target Variable from within an operation, such as the Read operation to the File connector
  or the Store operation to the Database connector.

- Using the DataWeave Transform Component (EE-Only)

- Using Scripting Component (in scripting module)

You can also delete/remove:

- Using the Remove Variable component.

After creating a variable, you can access and use it within the scope of a Mule flow where you
created it, which includes any flows that are joined with it through a Flow Ref component.

- `vars`: Keyword for accessing a variable, for example, through a DataWeave expression in a Mule
  component, such as the Logger, or from an Input or Output parameter of an operation. If the name
  of your variable is `myVar`, you can access it like this: `vars.myVar`

Note that a variable in the Mule event is different from variables defined in a DataWeave script,
which are local to the script and not accessible outside of it.

## See Also

- [Mule Events](https://docs.mulesoft.com/mule-runtime/4.4/about-mule-event)

- [Set Variable Transformer](https://docs.mulesoft.com/mule-runtime/4.4/variable-transformer-reference)

- [Flow Reference Component](https://docs.mulesoft.com/mule-runtime/4.4/flowref-about)

- [Enrich Data with Target Variables](https://docs.mulesoft.com/mule-runtime/4.4/target-variables)

- [DataWeave Language](https://docs.mulesoft.com/mule-runtime/4.4/dataweave)
