BookatlasTwo-Day MuleSoft → Salesforce Bootcamp
7 / 81 · Module 4 — Salesforce Connector · filtered: interview← prev⊞ allnext →

4.5What Query returns

Suppose Salesforce contains:

Account

Id: 001ABC
Name: Acme
External_Customer_ID__c: CUST-123

Your connector result is conceptually a collection:

[
  {
    "Id": "001ABC",
    "Name": "Acme",
    "External_Customer_ID__c": "CUST-123"
  }
]

So this is important:

payload[0].Id

might retrieve the first Account.

But don't blindly do:

payload[0]

unless your business logic guarantees one record.

You need to think about three cases:

0 records
1 record
>1 records

For a supposedly unique external ID:

0 → not found
1 → normal
>1 → data-integrity problem

That is exactly the kind of observation that makes a QA engineer sound like a developer rather than someone merely wiring components together.