Accessing and Modifying Mule Events10% of the exam
Flow variables with Set and Remove Variable
How Mule 4 variables are created (Set Variable, Transform Message, operation targets), read with `vars`, removed with Remove Variable, and scoped to the flow and its Flow Reference calls, including what a variable holding `payload`, `attributes` or `message` returns later and why error handlers can still read it.
Apply correct processors/DataWeave expressions to access and modify Mule variables, and predict outcomes.
~7 min read · 8 practice questions ·
What the exam expects
- Read a variable with
vars.nameand reject expressions such asflowVars.name,variables.nameormessage.name. - Name the ways to create or update a variable (Set Variable, an operation's target, Transform Message) and pick Transform Message when one step must set both the payload and a variable.
- Predict what Remove Variable does to a later read, and what happens when it names a variable that does not exist.
- Predict what a variable that stored
#[payload],#[attributes]or#[message]returns after later components change the message. - Decide where a variable is visible: the flow, flows joined by Flow Reference and the error handler, but not another Mule application called over HTTP.
- Key terms: Mule variable (per-event value stored on the event, outside the message);
vars(predefined DataWeave variable holding all variables on the event); Set Variable (Core transformer that creates or updates a variable); Remove Variable (Core transformer that deletes a variable from the event).
Key facts
Read syntax
- Detail
vars.myVar
Ways to create or update
- Detail
- Set Variable, operation target, Transform component, Scripting component
Keyword values
- Detail
payload,attributes,messageallowed;varsnot allowed
Variable names
- Detail
- Numbers, characters and underscores only; no hyphens
Transform Message variables
- Detail
<ee:set-variable>inside<ee:variables>, beside<ee:set-payload>
Removed variable read
- Detail
- Returns
null
Removing a missing variable
- Detail
- Logs
WARN; no error
Scope
- Detail
- The flow plus flows joined by Flow Ref
Flow Reference reach
- Detail
- Routes the event within the same Mule application
Error handler
- Detail
- A variable set before processing keeps the original payload for the handler
Sources for this section (5)
- Variables in Mule Appsdocs.mulesoft.com (opens in a new tab)
- Set Variable Transformerdocs.mulesoft.com (opens in a new tab)
- Transform Component XML Referencedocs.mulesoft.com (opens in a new tab)
- Remove Variable Transformerdocs.mulesoft.com (opens in a new tab)
- Flow Reference Componentdocs.mulesoft.com (opens in a new tab)
- Why would a variable named
claim-idbe rejected by Set Variable? - When is a variable declared with
varinside a DataWeave script visible? - What happens to variable changes made by a referenced flow when the Flow Reference has no target?
- Why can a flow called by Flow Reference read the caller's variables?
The questions are free to read. Answers with their sources and self-grading are included with the pack.
Keep reading with the MuleSoft Developer pack
- Core concepts
- Exam traps
- Worked scenario
The pack includes:
- All 40 lessons of the MuleSoft Developer guide, with reading progress
- Interactive decision walks and step-by-step sequence steppers
- Practice exams purchase adds inline bank questions and topic practice (8 questions for this lesson)
- An official source cited for every claim
- An AI tutor that answers from the guide
- Unlimited timed practice exams