4

Can someone tell me how to query the data which is displayed in " Monitor Bulk Data Load Jobs" Section "Completed last 7 days"

3 Answers 3

2

It seems the functionality is not exposed by Salesforce at all. Those objects are not avialable in APEX. As I checked all Apex supported objects(with globalDescribe) and none of them have "750" as object prefix.
Also as far as I know the bulk API endpoints also do not support listing of the jobs. You only can access the jobs by providing JobId. Bulk API Walkthrough

0

I don't have any orgs with bulk jobs to look at off hand to figure out exactly which fields are the ones displayed, but this should help you get started:

SELECT CompletedDate, Id, JobItemsProcessed, Status FROM AsyncApexJob
WHERE CompletedDate = LAST_N_DAYS:7
1
  • 1
    AsyncApexJobs doe not include bulk data load jobs Feb 19, 2019 at 22:26
0

Send an HTTP callout to the Bulk API v2.0, REST and JSON enabled. Not that bad.

final String VERSION_BULKJOB_WAS_MADE_WITH = 'v53.0';
final Id ASYNCAPIJOB_ID = '750000123456789';
HttpRequest req = new HttpRequest();
String endPointUrl = URL.getOrgDomainUrl().toExternalForm() + '/services/data/' + VERSION_BULKJOB_WAS_MADE_WITH + '/jobs/ingest/' + ASYNCAPIJOB_ID;
req.setEndpoint(endPointUrl);
req.setMethod('GET');
req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionId());
Http http = new Http();
HTTPResponse response = http.send(req);
String respBody = response.getBody();
System.debug('respBody: ' + respBody);

Sample response:

{
    "id": "750000123456789",
    "operation": "insert",
    "object": "MyObject__c",
    "createdById": "005000000012345AAA",
    "createdDate": "2022-02-19T03:00:36.000+0000",
    "systemModstamp": "2022-02-19T03:01:46.000+0000",
    "state": "JobComplete",
    "concurrencyMode": "Parallel",
    "contentType": "CSV",
    "apiVersion": 53,
    "jobType": "V2Ingest",
    "lineEnding": "LF",
    "columnDelimiter": "PIPE",
    "numberRecordsProcessed": 10293,
    "numberRecordsFailed": 0,
    "retries": 0,
    "totalProcessingTime": 66100,
    "apiActiveProcessingTime": 59388,
    "apexProcessingTime": 0
}

Hope that helps!

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.