BookatlasTwo-Day MuleSoft → Salesforce Bootcamp
10 / 81 · Module 5 — Salesforce Data Model + SOQL · filtered: interview← prev⊞ allnext →

5.44Scenario 3 — Account and Contacts together

SELECT
    Id,
    Name,
    External_Customer_ID__c,
    (
        SELECT
            Id,
            FirstName,
            LastName,
            Email
        FROM Contacts
    )
FROM Account
WHERE External_Customer_ID__c = :customerId

Result conceptually:

{
  "Id": "001ABC",
  "Name": "Acme",

  "Contacts": {
    "records": [
      {
        "Id": "003A",
        "FirstName": "John"
      },
      {
        "Id": "003B",
        "FirstName": "Sarah"
      }
    ]
  }
}

Then DataWeave turns that into your public API contract.