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

18.46The corresponding DataWeave

Account:

%dw 2.0
output application/java
---
[{
    External_Customer_ID__c:
        payload.customerId,

    Name:
        payload.companyName,

    (Phone: payload.phone)
        if (payload.phone != null)
}]

Contacts after Account upsert:

%dw 2.0
output application/java
---
vars.originalCustomer.contacts
    map (contact) -> {
        External_Contact_ID__c:
            contact.contactId,

        FirstName:
            contact.firstName,

        LastName:
            contact.lastName,

        AccountId:
            vars.accountId
    }

Those two snippets are worth knowing cold.