3.38A DataWeave interview exercise
Interviewer gives you:
{
"customers": [
{
"id": "1",
"name": "Acme",
"active": true
},
{
"id": "2",
"name": "Old Inc",
"active": false
},
{
"id": "3",
"name": "Widget",
"active": true
}
]
}
and asks:
Transform active customers for Salesforce.
You should be able to produce approximately:
%dw 2.0
output application/java
---
payload.customers
filter (customer) -> customer.active
map (customer) -> {
External_Customer_ID__c: customer.id,
Name: customer.name
}
If you can write that without panicking, you're already in decent shape.