Historical backfill

Historical backfill

The event poller only sees changes made after the subscription exists. A historical backfill pulls records that already exist in Bullhorn into Salesforce in bulk. Backfilled records flow through the normal inbound engine, so field mappings, transformers, dependency resolution (parents such as Client Corporations are created before their contacts) and error handling all apply exactly as they do for live events.

Backfills are safe to re-run at any time. Records are matched by external id, so running the same backfill twice updates records rather than duplicating them.

From the dashboard

The Bullhorn Sync Dashboard includes a Historical Backfill card:

  1. Pick the Bullhorn entity. The list shows every active mapping whose direction is Inbound or Bidirectional.
  2. Optionally pick a From and To date. These filter on the record's Bullhorn created date (dateAdded) and are inclusive of both days. Leave both blank to backfill every record of the entity.
  3. Optionally enter a record filter (see below) to backfill only a subset, for example only active candidates.
  4. Click Start backfill.

While a backfill is active, click Stop backfill to cancel every queued or running backfill page job. Events already created by completed pages are retained and continue through the inbound engine, so stopping does not leave partially written Salesforce records or discard auditable work.

Record filter

The optional filter is an extra condition combined (AND) with the id paging and date range on every page request. The syntax follows the Bullhorn endpoint the entity supports:

Entity kind Endpoint used Filter syntax Example
Query entities (most associations and settings entities) query Where-clause style status='Active'
Search entities (Candidate, ClientContact, ClientCorporation, JobOrder, JobSubmission, Placement, Note, Lead, Opportunity) search Lucene status:"Active" or status:("Active" OR "Placed")

The backfill picks the endpoint automatically: it tries query first and switches to search when Bullhorn reports the entity cannot be queried, so large person entities such as Candidate work out of the box. If the filter syntax is invalid for the endpoint the job fails visibly on the Historical Backfill card; correct the filter and start again.

Tip: for a filter that should apply to live syncing as well (not just backfill), set a filter on the entity mapping instead - see the entity mapping JSON schema article (/docs/x3b-bh-integration/entity-mapping-json-schema). The mapping filter marks non-matching inbound records as Skipped whichever way they arrive.

The card shows whether a backfill is currently running, how many inbound events are still pending, and the outcome of the last backfill job including any error message. Progress can also be followed on the Sync Events tab and the event stats card, where the backfilled events appear with event type INSERTED. If an older package version left a backlog with no processor, click Resume pending to start the inbound worker immediately.

From Apex

Subscriber code and anonymous Apex can start the same backfill:

// Everything
bh_3b.BH_SyncApi.startBackfill('ClientContact', null, null);

// Only records created in 2025
bh_3b.BH_SyncApi.startBackfill('ClientContact',
    Date.newInstance(2025, 1, 1), Date.newInstance(2025, 12, 31));

// Only active candidates (Candidate is a search entity - Lucene syntax)
bh_3b.BH_SyncApi.startBackfill('Candidate', null, null, 'status:"Active"');

// Stop all active backfill page jobs. Completed-page events are retained.
Integer stoppedJobs = bh_3b.BH_SyncApi.stopBackfills();

// Recover a Pending inbound backlog if no processor is active.
Id processorJobId = bh_3b.BH_SyncApi.resumePendingInbound();

The call validates that an active inbound-capable mapping exists for the entity and that the date range is not inverted, then returns the id of the background job.

How it works

The backfill job pages through the Bullhorn entity 200 records at a time, ordered by id, and creates a Pending inbound sync event for each record. Entities that Bullhorn only exposes through its search API (Candidate and the other person entities) are paged through search with the same id checkpoint, so the behaviour is identical. The inbound processor picks the events up and syncs them in its normal batches. Large entities produce one Bullhorn API call per 200 records for the paging plus the usual per-record fetch during processing, and all calls are recorded in the API usage ledger under the same categories as live sync.

Points to be aware of:

Order of entities

Dependencies are resolved automatically, so a ClientContact backfill creates missing parent Client Corporations on the fly. For very large datasets it is still faster and lighter on API calls to backfill parents first (for example ClientCorporation, then ClientContact, then Placement), because the parents then already exist when the children arrive.