4.4QUERY
This is probably the Salesforce operation you'll use most besides Upsert.
Imagine:
GET /customers/CUST-123
Mule needs to find the corresponding Salesforce Account.
Flow:
HTTP Listener
↓
Salesforce Query
↓
Transform response
SOQL:
SELECT
Id,
Name,
Phone,
BillingCity,
BillingState
FROM Account
WHERE External_Customer_ID__c = :customerId
The connector's Query operation accepts SOQL and supports parameters.
Conceptually:
query:
SELECT Id, Name
FROM Account
WHERE External_Customer_ID__c = :customerId
parameters:
{
customerId: vars.customerId
}
This is preferable to dynamically constructing:
"... WHERE External_Customer_ID__c = '"
++ vars.customerId
++ "'"
for exactly the reasons you'd expect from other database/API development:
safer
cleaner
escaping handled correctly
easier to maintain