BookatlasTwo-Day MuleSoft → Salesforce Bootcamp
5 / 81 · Module 3 — DataWeave 2.0 Crash Course · filtered: interview← prev⊞ allnext →

3.6DataWeave variables vs Mule `vars`

Important interview distinction.

Inside DataWeave:

var customer = payload.customer

is a DataWeave variable.

For example:

%dw 2.0
output application/json

var customer = payload.customer

---
{
    name: customer.name,
    city: customer.billing.city
}

That's local to the DataWeave script.

Mule:

vars.customer

belongs to the Mule event and can survive across processors in a flow.

So:

DataWeave var
= local transformation variable

Mule vars
= flow/event variable

DataWeave variables themselves are immutable, which fits its functional-programming model.