When a custom object is created in Salesforce, how many associated objects are automatically created

When you create a custom object in Salesforce, Salesforce does automatically generate a few related system objects behind the scenes-

Suppose a custom object named Test_Obj is created. The following system objects might also be generated automatically: Test_Obj__ChangeEvent, Test_Obj__History, and Test_Obj__Share. However, the creation of these system objects depends on specific conditions, such as whether field history tracking or sharing rules are enabled.

  1. <CustomObject>__Share (Share Object)
    • Used to support record-level sharing.
    • Allows programmatic control over sharing access.
    • Automatically created for all custom objects that have organization-wide default (OWD) sharing settings set to Private or Public Read Only.
  2. <CustomObject>__History (History Object)
    • Created only if Track Field History is enabled on the custom object.
    • Stores a history of changes to fields you’ve selected for tracking.
  3. CustomObject>__ChangeEvent (Change Data Capture Object)
    • Created automatically when Change Data Capture (CDC) is enabled for the custom object.
    • Used to track data changes in near real-time for integrations.

Notes:

  1. These are not created immediately upon object creation unless specific features (like CDC or Field History Tracking) are enabled.
  2. They are system-generated objects used for platform functionality and integrations.
Object NameCreated Automatically?Condition
<CustomObject>__ShareYesIf OWD ≠ Public Read/Write
<CustomObject>__HistoryNoOnly if Field History Tracking is enabled
<CustomObject>__ChangeEventNoOnly if Change Data Capture is enabled

Leave a Comment

Your email address will not be published. Required fields are marked *