Is there any way to get the status of the bulk job load using job id for each job via apex?

enter image description here


It's possible to select Status field and other info from AsyncApexJob standard object via SOQL:

SELECT Id, Status, CompletedDate FROM AsyncApexJob where Id = :JobId

I'm not sure if you mean using the Bulk API or not, but if you are I think you can probably do this using a callout in Apex (if you're not, please disregard this answer), for example:

String pod = 'eu11';
String baseUrl = pod + '.salesforce.com';
String endpoint = baseUrl + '/services/async/36.0/job/' + jobId + '/batch/' + batchId;
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setHeader('X-SFDC-Session', UserInfo.getSessionId());

HttpResponse res = h.send(req);

More info in page 43 of this document.

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.