Module 3 — DataWeave 2.0 Crash Course
This is probably the highest-value module for your interview.
DataWeave is MuleSoft’s transformation and expression language. It reads structured data, transforms it, and emits another structure or format. It is also used inside Mule expressions, not only inside full Transform Message components.
For your interview, think of DataWeave as:
JavaScript
.map(),.filter(), object construction, type conversion, and JSON/XML serialization combined into one language.
The syntax looks unusual for about an hour. Then it starts becoming predictable.
3.1codeThe basic structureA DataWeave script usually looks like:3.2codeYour first transformationInput:3.3codeSalesforce field mappingExternal input:3.4codeNested propertiesInput:3.5codeVariablesRemember Mule variables from Module 2:3.6codeDataWeave variables vs Mule `vars`Important interview distinction.3.7codeArrays: the really important partSuppose payload is:3.8code`$` shorthandDataWeave lets you write:3.9codeReal Salesforce bulk mappingIncoming:3.10codeFilteringInput:3.11codeFilter + mapThis is common.3.12code`default`This is incredibly useful.3.13codeNull versus missing fieldThis matters in integration work.3.14codeConditional valuesSimple example:3.15codeConditional fieldsThis is different and extremely useful.3.16codeAnother realistic conditional Salesforce mappingThis prevents accidental Salesforce field clearing.3.17codeType conversion with `as`Incoming:3.18codeString → Number exampleInput:3.19codeDatesYou don't need to become a DataWeave date guru before the interview.3.20codeStringsYou'll frequently need basic cleanup.3.21codeString concatenationSuppose:3.22code`mapObject`map transforms arrays.3.23code`pluck`Useful mental model:3.24code`flatten`Suppose:3.25code`distinctBy`Integration developers frequently receive duplicate data.3.26code`groupBy`Imagine orders:3.27codeObject merging with `++`++ isn't only string concatenation.3.28codeFunctionsYou can define reusable functions:3.29codeA more realistic reusable functionSay several fields need defaults:3.30codeTransform XML → JSONMule integrations aren't always JSON.3.31codeCSV → SalesforceInput:3.32codeA realistic Salesforce Account + Contact transformationInput:3.33codeHandling arrays of nested contactsNow Acme has several contacts:3.34codeSafe navigation / null handlingThis is where developers get bitten.3.35codeDataWeave isn't validationThis distinction will make you sound mature.3.36codeSalesforce relationship fieldsThis becomes important.3.37codeTransforming Salesforce query resultsSuppose Salesforce Query returns records conceptually like:3.38Q&AcodeA DataWeave interview exerciseInterviewer gives you:3.39codeHarder exerciseInput:3.40What NOT to memorizeDon't spend tonight trying to memorize:•codeYour DataWeave survival setMemorize these:•Next: Module 4 — Salesforce ConnectorThis is where your existing experience becomes especially useful. We should cover Query, Query All, Create, Update, Upsert, Delete, SOQL…