BookatlasTwo-Day MuleSoft → Salesforce Bootcamp
65 / 81 · Module 17 — Interview System-Design Scenarios · filtered: interview← prev⊞ allnext →

17.4DataWeave

Input:

{
  "customerId": "C001",
  "companyName": "Acme",
  "phone": "3055551234",
  "billingState": "FL"
}

Salesforce payload:

%dw 2.0
output application/java
---
[{
    External_Customer_ID__c: payload.customerId,
    Name: payload.companyName,
    (Phone: payload.phone) if (payload.phone != null),
    BillingState: payload.billingState
}]

Notice the conditional phone field.

Why?

Because:

omitted

might mean:

preserve existing Salesforce value

rather than:

set it to null