BookatlasTwo-Day MuleSoft → Salesforce Bootcamp
269 / 278 · Module 18 — Interview Coding Scenarios · filtered: code← prev⊞ allnext →

18.34Another DataWeave challenge — group by customer

Input:

[
  {
    "customerId": "C001",
    "amount": 100
  },
  {
    "customerId": "C001",
    "amount": 50
  },
  {
    "customerId": "C002",
    "amount": 25
  }
]

High-level:

payload groupBy $.customerId

produces groups keyed by customer ID.

If they push into aggregation, you can build from there.

You don't need advanced DataWeave gymnastics unless the role explicitly emphasizes it.