I have a class that is Database.Batchable which I execute via Database.executeBatch. How do I find the job status Id using the id returned from Database.executeBatch? It doesn't seem to match the Id I get from querying AsyncApexJob. Is there a way to get the status via Apex?

  • Did you check the answer here? It's not working for you? – Brian Miller Apr 1 '19 at 21:14

The ids are truncated on the salesforce ui but you can query it via

SELECT Id, Status, ApexClassID, JobItemsProcessed, TotalJobItems, JobType, CompletedDate, ExtendedStatus FROM AsyncApexJob WHERE Id = 'id'

  • Not sure how this answers your original question - can you update your question? – Brian Miller Apr 1 '19 at 21:22
  • Also it would be better to show this as using a binding variable on the assumption you would do this from Apex. – Phil W Apr 1 '19 at 22:39

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.