'What is the best way to achieve the following use case in Mulesoft? Which salesforce connector or method will be the most performant?

I've got an array of Ids as an input. I've got to dynamically execute a salesforce query as many number of times as there are Ids. Example:

If my input is ["a", "b", "c"] and the salesforce query is : SELECT Id, Name FROM Account WHERE Name = ""

Then, three queries should be generated,

1.SELECT Id, Name FROM Account WHERE Name = 'a'
2.SELECT Id, Name FROM Account WHERE Name = 'b'
3.SELECT Id, Name FROM Account WHERE Name = 'c'

P.S. : The Salesforce queries should be executed together, minimising the number of calls, I thought of using composite connector, but it has a limit of 25 requests in a call (I can have as high as 100 Ids), Also thought about composite graph API, but it doesn't support querying.



Solution 1:[1]

I recommend using an IN operator on the query to lower the number of API calls you do. It will look something like this:

SELECT Id, Name FROM Account WHERE Name IN ('a', 'b', 'c')

I'm not sure about the maximum (I feel it's 100). You need to use DataWeave to build that query. It will look something like this:

"SELECT Id, Name FROM Account WHERE Name IN ('" ++ (vars.ids joinBy "','") ++ "')" 

Ref:

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jorge Garcia