With the default GetContactByPhoneNumber or GetAccountByPhoneNumber Salesforce Data Actions, it is required that exactly one result be found for the response to be successfully flattened and used in a call flow (similar to the older equivalent bridge connector actions). With a slight modification to the successTemplate, multiple records can be processed.
To try it yourself, here's a test endpoint with Salesforce sample data:
GET https://demo4653912.mockable.io/contacts
Start by making a copy of the default Salesforce data action - the copy will be "Custom" instead of "Static" with editable contracts and configurations. We're only changing the successTemplate in the response config.
Here's the default response config for GetContactByPhoneNumber (outputs an array that can't be flattened):
{ "translationMap": { "contact": "$.searchRecords" }, "successTemplate": "${contact}" }
Here's the output from the default successTemplate with multiple SF contact results (cannot be flattened). It's an array with no name (anonymous) and is not enveloped in an object:
[ {<contact>}, {<contact>}, {<contact>} ]
Here's an updated response config with successTemplate that (1) puts array in an object and (2) names the array (anonymous arrays break flattening):
{ "translationMap": { "contact": "$.searchRecords" }, "successTemplate": "{\"contacts\": ${contact}}" }
Output from updated successTemplate with multiple SF contact results:
{ "contacts": [ {<contact>}, {<contact>}, {<contact>}] }
This object with a named array can be flattened and used in Architect. Nested arrays will still break flattening, so there are still some limitations, but in general with the right translationMap and successTemplate, you can filter and name collections so they can be processed by call flows.
For full details and sample data, see this Pastebin: https://pastebin.com/FVZ2aQVT