Loading

How to pass fetch size parameter to salesforce query and query all operation in mule 4

Julkaisupäivä: Aug 5, 2025
Tehtävä

GOAL:

How to pass fetch size/batch size parameter to salesforce query and query all operation in mule 4
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_header_queryoptions.htm#topic-title
Vaiheet
To set the batchSize we can pass header from the salesforce connector as shown in below:
<salesforce:query-all doc:id="dfd21003-58b6-4ec1-9f57-5cb4f35e2274" config-ref="Salesforce_Config" 
headers='#[{"QueryOptions": {"batchSize":200}}]'>

      Batch size

Salesforce Query operation fetches 2000 records in one batch by default. By setting this parameter it will fetch as many records set in this parameter. Below are the things to note down if you are using batchSize - 

  • In mule 4 pagination is handled internally by mule runtime
  • Even if we set a batch size, It will not return a complete result set unless all the records are fetched
  • It makes multiple calls to salesforce till all the records are fetched and then streams a complete result set
Knowledge-artikkelin numero

001115943

 
Ladataan
Salesforce Help | Article