One way to do that would be to use EnsLib.RecordMap.Service.BatchFileService and configure it with BatchHandling = Whole Batch.
If you do that your Business Process will receive a Batch object that serves as parent to the individual Records in the file. You can do the truncate, then loop over the records and process each one.
I find this kind of workflow easier to implement using the graphical Business Process (BPL) editor.
In BPL you'd use a Call element to invoke your Business Operation asynchronously, and a Sync element to catch the response message when it's sent back later. You can do other processing between those elements, such as making other Calls.
Here's a link to documentation that provides an example of making 2 concurrent async calls to Business Operations, waiting for both of them to return, then deciding what to do next based on content of the responses.
https://docs.intersystems.com/iris20252/csp/docbook/DocBook.UI.Page.cls?...
If you prefer code, you'll need to implement onResponse in your Business Process. That will be called by the framework when the async response comes back from your Operation. I don't think you'd want to branch back to onRequest from there however. You'd just put the logic to handle the response in onResponse.




if ($this = "%Studio.General") { ... }