The sync engines consume the BH Sync Event work queue in both directions. Events with Status Pending are picked up automatically the moment they are created, processed in configurable batch sizes, and finished as Completed, Failed or Dead. This article explains what happens inside a batch and how to configure and extend the behavior.
When inbound events enter Pending status (from the poller, a retry sweep or a manual sync), a background processor claims a batch (Inbound Batch Size setting, default 25) and for each event:
fetchFields. The event only tells the engine what changed; the fetch supplies the full current state.dependencies list the engine reads the parent reference from the payload (for example clientCorporation.id), looks the parent up in Salesforce by its external id field, and if the parent does not exist yet fetches it from Bullhorn and creates it first. This recursion is bounded by the Max Dependency Depth setting (default 4) and works for whole chains: grandparents are created before parents, parents before children. Everything is matched by external id, never by position.fieldMap entries (dotted paths supported, arrays collapse to their first element), computedFields joins, dateFields conversion from Bullhorn epoch milliseconds to Date or Datetime depending on the target field type, valueMaps translations and custom transformers.A required dependency that cannot be resolved fails the whole event. No partial records are ever written.
DELETED events set the mapping's deleteField checkbox to true on the matched Salesforce record. If no record matches, the event completes as an expected no-op. If the mapping has no deleteField, deletes are ignored.
Administrators or custom code can pull a single record on demand:
Id eventId = bh_3b.BH_SyncApi.syncFromBullhorn('ClientContact', 12345);
This queues a normal inbound event and returns its id so the result can be inspected on the BH Sync Event record.
To pull existing Bullhorn data in bulk rather than one record at a time, use the historical backfill instead: see Historical backfill.
Outbound sync is triggered from record-triggered Flows that the implementation team creates per object. The package provides the invocable action Bullhorn: Enqueue Outbound Sync (category Bullhorn Sync) with these inputs:
| Input | Required | Purpose |
|---|---|---|
| Record Id | yes | The Salesforce record to sync |
| Bullhorn Entity Name | yes | The mapped entity, for example ClientContact |
| Changed Fields (CSV) | no | Comma separated field API names that changed, for example LastName,Email |
| Action | no | Set to DELETE to soft delete the record in Bullhorn |
Recommended Flow recipe: a record-triggered Flow (after save, on create and update) that passes the record id, the entity name and the changed field names, plus a second Flow on delete (or a checkbox driven process) that passes Action = DELETE.
The action inserts an outbound event; it performs no callouts, so it is safe in any Flow context. The processor then:
{"id": n} read from the related record's external id. The new Bullhorn id is written back into the external id field automatically.A create for a required relationship whose parent has no external id yet fails with stage dependency. Sync the parent first (or let the retry sweep pick the event up once the parent has synced).
Entities with a uniqueAssociation constraint in their mapping (for example Placement on candidate plus jobOrder) use a safe create: an existing active row is updated instead, a soft-deleted row is restored and updated, and only then is a new row created. This prevents duplicate-constraint errors that count soft-deleted rows.
bh_3b.BH_SyncApi.enqueueOutbound(recordId, 'ClientContact',
new Set<String>{ 'LastName', 'Email' });
Without protection, an inbound write would fire the outbound Flow and bounce the same change back to Bullhorn. The mapping's suppressField checkbox breaks this loop:
The packaged helper fields on Account and Contact (see below) include a suppress checkbox for this purpose. Custom objects need their own checkbox referenced as suppressField in the mapping. If no suppressField is configured the feature is off and Flows should use another loop guard.
The package ships three fields on both Account and Contact so the most common mappings work out of the box:
| Field | Type | Purpose |
|---|---|---|
Bullhorn External Id (BH_External_Id__c) |
Text 40, external id | Holds the Bullhorn record id; upsert key in both directions |
Bullhorn Suppress Sync (BH_Suppress_Sync__c) |
Checkbox | Echo suppression flag |
Bullhorn Is Deleted (BH_Is_Deleted__c) |
Checkbox | Set when the record is deleted in Bullhorn |
Both permission sets grant read and edit on all six fields. Reference them in mapping JSON as externalIdField, suppressField and deleteField.
When value maps and date handling are not enough, a subscriber developer can plug in a transformer class:
global class MyStatusTransformer implements bh_3b.BH_Transformer {
global Object transform(Object value, Map<String, Object> record,
Map<String, String> params, Boolean isInbound) {
return isInbound ? 'SF ' + value : String.valueOf(value).removeStart('SF ');
}
}
Reference it in the mapping JSON, keyed by the Salesforce field:
{ "transforms": { "Status__c": "myns.MyStatusTransformer" } }
The chain per field is: value map translation, then date conversion, then the custom transformer. A value missing from a value map passes through unchanged.
Every event ends in exactly one state:
config, fetch, dependency, map, push, dml, rate_limit, unhandled) and a full description are stored on the event. The retry sweep re-drives Failed events after their Next Retry At time using exponential backoff (Retry Base Delay Minutes times 2 per attempt).Rate limiting by Bullhorn is handled specially: the whole batch is rescheduled at least 5 minutes out and no retry attempt is consumed.
Manual retry resets the budget and works on Dead events too:
bh_3b.BH_SyncApi.retryEvents(new Set<Id>{ eventId });
Scheduler control is also exposed for admin tooling:
bh_3b.BH_SyncApi.startScheduler(5); // poll every 5 minutes
bh_3b.BH_SyncApi.stopScheduler();