Find Apex batch status programmatically
I have a batch class, I need to email and run another batch in the ‘Finish’ method of batch ONLY IF the batch ran successfully. I would like to have batch status in the finish method (like the batch status as we see in the apex jobs), so that I could check for it and if it was completed then finish() should perform necessary tasks.