With external change data capture enabled, Codey Outfitters’ org polls the external system every 30 minutes. To monitor the tracking status, it queries the BackgroundOperation object. Codey Outfitters prefers to run SOQL queries in the Query Editor of the Developer Console, but you can use your preferred tool.
Here’s the SOQL query that Codey Outfitters uses to monitor the tracking status.
SELECT Id,Name,SubmittedAt,StartedAt,FinishedAt,ProcessAfter,Status
FROM BackgroundOperation WHERE WorkerUri='v45.0/xds/data-changes'
In the query results, the first row shows the initial callout to the external system. The initial request tells the OData producer to start tracking changes on the Products__x object. In the second row, the org schedules the next callout to request the tracked changes. Notice that the callout is scheduled to occur after 30 minutes have passed.
| ID | Name | Submitted | Started | Finished | Process After | Status |
|---|---|---|---|---|---|---|
| 08Pxx0000000019EAA | Products__x | 2017-10-06T01:11:04.000Z | 2017-10-06T01:11:08.000Z | 2017-10-06T01:11:08.000Z | Complete | |
| 08Pxx000000000qEAA | Products__x | 2017-10-06T01:11:08.000Z | 2017-10-06T01:41:08.000Z | Waiting |
After waiting 30 minutes, querying the BackgroundOperation object shows that the second callout finishes, and the status is Complete. In the third row, a new change request is scheduled to run after 30 more minutes have passed.
| ID | Name | Submitted | Started | Finished | Process After | Status |
|---|---|---|---|---|---|---|
| 08Pxx0000000019EAA | Products__x | 2017-10-06T01:11:04.000Z | 2017-10-06T01:11:08.000Z | 2017-10-06T01:11:08.000Z | Complete | |
| 08Pxx000000000qEAA | Products__x | 2017-10-06T01:41:09.000Z | 2017-10-06T01:41:09.000Z | 2017-10-06T01:41:09.000Z | 2017-10-06T01:41:08.000Z | Complete |
| 08Pxx000000002MEAQ | Products__x | 2017-10-06T01:41:09.000Z | 2017-10-06T02:11:09.000Z | Waiting |
Suppose that the Codey Outfitters inventory has a service outage, preventing the scheduled poll request from succeeding. Errors cause change tracking to stop, so querying the BackgroundOperation object shows the error status and no new rows.
| ID | Name | Submitted | Started | Finished | Process After | Status |
|---|---|---|---|---|---|---|
| 08Pxx0000000019EAA | Products__x | 2017-10-06T01:11:04.000Z | 2017-10-06T01:11:08.000Z | 2017-10-06T01:11:08.000Z | Complete | |
| 08Pxx000000000qEAA | Products__x | 2017-10-06T01:41:09.000Z | 2017-10-06T01:41:09.000Z | 2017-10-06T01:41:09.000Z | 2017-10-06T01:41:09.000Z | Complete |
| 08Pxx000000002MEAQ | Products__x | 2017-10-06T01:41:09.000Z | 2017-10-06T02:12:07.000Z | 2017-10-06T02:12:07.000Z | 2017-10-06T02:11:09.000Z | Error |
When query results show no rows in Waiting status, external change data capture is disabled. When the query results show an error, you can get error details by including the Error field in your SOQL query of the BackgroundOperation object. Here’s how Codey Outfitters investigates the error.
SELECT Error FROM BackgroundOperation WHERE Id=’08Pxx000000002MEAQ’
Because a service outage caused the problem, the error message says:
The external system is unreachable. Try again later, or contact your admin, who can verify the external data source settings and the external system's availability. Attempted to reach this URL: https://codey-outfitters.example.com/inventory/Products
Codey Outfitters fixes the service outage and restarts change tracking on the Products__x object.