2.15What if we need Account + Contact?
Now we start getting closer to real Mule work.
Input:
{
"customerId": "CUST-10042",
"companyName": "Acme Corporation",
"contact": {
"firstName": "John",
"lastName": "Smith",
"email": "john@acme.com"
}
}
We need:
Account
↓
Contact
where:
Contact.AccountId = Account.Id
Possible flow:
HTTP Listener
↓
Save original request
↓
Transform Account
↓
Upsert Account
↓
Save account ID
↓
Transform Contact
↓
Upsert Contact
↓
Response
This introduces another very important Mule pattern:
payload
↓
save result into variable
↓
change payload
↓
continue