Subscribe to Query Job Platform Events (Beta)

Use the standard platform event BulkApi2JobEvent to get query job status updates and begin downloading results before the query job completes.

Bulk API V2 query standard platform events is a pilot or beta service that is subject to the Beta Services Terms at Agreements - Salesforce.com or a written Unified Pilot Agreement if executed by Customer, and applicable terms in the Product Terms Diretctory. Use of this pilot or beta service is at the Customer's sole discretion.

Note

To enable this beta, follow these steps. You must have either the Modify All Data or the Customize Application permission.

  1. From Setup, in the Quick Find box, enter User Interface, and then select User Interface.
  2. On the User Interface page, select Enable Salesforce Platform Bulk API 2.0 Query Partial Download and Job Completion Events (Beta).

    Selecting this item asserts that you accept the Beta Services Terms provided at the Agreements and Terms.

    Note

  1. Choose a supported subscriber.
    Use the /event/BulkApi2JobEvent channel to subscribe to Bulk API 2 query job platform events when configuring a subscription. See Subscribing to Platform Events.
  2. Start a Bulk API 2 query job.
    Your code can process events associated with the job ID in the response body. See Create a Query Job.
This event indicates job status. The unique ID in JobIentifier is the same ID that you get from the query job response body.

 {
"Type"  : "JOB_STATE",
"JobIdentifier" : "750xx000004UeCCB",
"JobState" : "InProgress",
"ResultType" : null,
"ResultUrl" : null  
}
This event indicates that a set of results is available. Your client uses the unique URL in ResultUrl to get the results.

 {
"Type" : "RESULT",
"JobIdentifier" : "750xx000004UeCCB",
"JobState" : "InProgress",
"ResultType" : "PARTIAL",
"ResultUrl" : "https://mydomain.salesforce.com/services/data/v63.0/jobs/query/750xx000004UeCCB/results?locator:AOTUALft490873ALSH353w4oithw404FKJ"
}
This event indicates that only one set of results remains. Your client uses the ResultUrl URL to get the last set of results.

 {
"Type" : "RESULT",
"JobIdentifier" : "750xx000004UeCCB",
"JobState" : "JobComplete",
"ResultType" : "FINAL",
"ResultUrl" : "https://mydomain.salesforce.com/services/data/v63.0/jobs/query/750xx000004UeCCB/results?locator:aSdEft490873ALSH353w4oithw404jKlM"
}