Requirement: I have a VF Page where a user would upload a CSV file which should be inserted/upserted in Salesforce Custom Object. In this process I would be doing an Call out to verify whether a field in CSV file is valid comparing an External System(SOAP API Calls).

So to avoid the limitations in API call out, we have implemented a Batch Apex to do the validation part. But the issue we are facing is the redirection of the page. After the Upload page, I want next page to show how many records got success to be uploaded and how many got failed. But this validation being done by a Batch Apex and all methods being void, I am unable to figure it out how to achieve this functionality.

Please advise.

  • I feel that's not so possible as it is an asynchronous process, and we need a redirection. Both are contradictory conditions. Or is there any other possible way to achieve this functionality??? Jun 1 '17 at 7:19

You can redirect the user to the next page immediately.

Keep updating some custom object records after each batch, and delete all those custom object records once all your batches get executed (in Finish method).

Using apex:actionPoller you can query the records from that custom object, and display them by refreshing a particular part of your page asynchronously.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.