0
votes

i have flow where I use a salesforce connector create a job and many batches under the same job. Each batch inserts 1000 records in salesforce.

I would like to know whether the salesforce batch information is returned to the flow only after the batch is completed in salesforce or the batch information is returned soon after the creation of the batch in salesforce.

The above information is very much required to conclude my design.

Thank you in advance.

1

1 Answers

1
votes

The batch jobs in the connector will return the BatchInfo almost immediately with their initial state. The completed batch never communicates back with Mule. But one way to check if the batch is completed etc. is to use sfdc:batch-info to query the status of the batch and check it. For example:

<until-successful objectStore-ref="tempStore"
            maxRetries="60" secondsBetweenRetries="60"
            failureExpression="payload.state == 'Queued' || payload.state == 'InProgress'"
            doc:name="Until Successful">
       <sfdc:batch-info doc:name="Check Batch" config-ref="Salesforce">
            <sfdc:batch-info apexProcessingTime="#[payload.apexProcessingTime]"
                apiActiveProcessingTime="#[payload.apiActiveProcessingTime]"
                createdDate="#[payload.createdDate]" id="#[payload.id]" jobId="#[payload.jobId]"
                numberRecordsFailed="#[payload.numberRecordsFailed]"
                numberRecordsProcessed="#[payload.numberRecordsProcessed]" state="#[payload.state]"
                stateMessage="#[payload.stateMessage]" systemModstamp="#[payload.systemModstamp]"
                totalProcessingTime="#[payload.totalProcessingTime]" />
        </sfdc:batch-info>
</until-successful>