PluginBench
Skill
Pass
Audit score 90

integration-eventing-cdc-configure

forcedotcom/sf-skills

Enable and configure Salesforce Change Data Capture on objects with custom channels, filters, and enrichment fields.

What is integration-eventing-cdc-configure?

Generates PlatformEventChannelMember and PlatformEventChannel metadata to subscribe Salesforce objects to Change Data Capture (CDC), with support for custom event channels, filter expressions, and enriched fields. Use this when setting up downstream systems to receive Salesforce data changes via CDC.

  • Enable CDC on standard or custom Salesforce objects
  • Create and configure custom event channels with the __chn suffix
  • Add enrichment fields to include related data in change events
  • Define filter expressions to gate which changes emit events
  • Generate properly-formatted PlatformEventChannelMember and PlatformEventChannel metadata files

How to install integration-eventing-cdc-configure

npx skills add https://github.com/forcedotcom/sf-skills --skill integration-eventing-cdc-configure
Prerequisites
  • Salesforce CLI (sf) version 2.0.0 or later
  • Salesforce org with API version 60.0 or higher
  • Source entity API names (standard or custom object names)
Claude Code
Cursor
Windsurf
Cline

How to use integration-eventing-cdc-configure

  1. 1.Identify which object(s) need CDC enablement (standard, custom, or both)
  2. 2.Determine the target channel: use 'ChangeEvents' for default or specify a custom channel name
  3. 3.List any enrichment fields needed (lookup IDs or related fields to include in events)
  4. 4.Define a filter expression if only certain changes should emit events (e.g., Status__c != null)
  5. 5.The skill generates PlatformEventChannelMember files for each subscribed entity and PlatformEventChannel files for custom channels
  6. 6.Deploy the generated metadata files to your Salesforce org

Use cases

Good for
  • Subscribe an Account object to CDC on the default ChangeEvents channel to sync account updates to a downstream system
  • Create a custom 'PartnerSync__chn' channel and subscribe multiple objects to emit only filtered events (e.g., Status != null)
  • Add enrichment fields like OwnerId and ParentId to change events so consumers receive lookup IDs without extra queries
  • Set up CDC for a custom Order__c object with a filter expression to emit events only when Amount exceeds a threshold
  • Configure CDC across both standard and custom objects feeding into a single custom event channel
Who it's for
  • Integration architects setting up real-time data synchronization
  • Salesforce developers implementing event-driven architectures
  • Platform engineers configuring change data capture for downstream systems
  • Admins enabling CDC subscriptions for external applications

integration-eventing-cdc-configure FAQ

What's the difference between the default ChangeEvents channel and a custom channel?

The default 'ChangeEvents' channel is built-in and requires no separate configuration file. Custom channels (ending in __chn) require a PlatformEventChannel metadata file and allow you to organize subscribers and apply channel-level settings.

How do I name a custom event channel?

Derive a DeveloperName from your label by stripping spaces and non-alphanumeric characters, converting to CamelCase, then appending __chn. For example, 'Partner Sync' becomes 'PartnerSync__chn'.

Can I use relationship traversals like Owner.Name as enrichment fields?

No. Enrichment fields must be single-hop API names on the source entity (e.g., OwnerId, MyLookup__c, Region__c). Relationship traversals like Owner.Name are rejected by the Metadata API.

What happens if I don't specify a filter expression?

Without a filter expression, all changes to the subscribed object emit events. Add a filter only if you want to gate events based on field values (e.g., Status__c != null).

Should I use this skill for publishing custom platform events?

No. This skill is for Change Data Capture (CDC) only. For publishing custom platform events, use the integration-connectivity-generate skill instead.

Full instructions (SKILL.md)

Source of truth, from forcedotcom/sf-skills.


name: integration-eventing-cdc-configure description: "Use to enable Salesforce Change Data Capture (CDC) on a standard or custom object, configure a custom event channel, set a filter expression, or add enrichment fields. TRIGGER broadly on any of: 'enable CDC', 'enable Change Data Capture', 'turn on CDC', 'subscribe X to change events', 'only emit events for', 'filter change events', 'enrich change events', 'create a custom event channel'; or any mention of CDC, change events, PlatformEventChannel, PlatformEventChannelMember, EnrichedField, ChangeEvents channel, enrichment fields, change event filter; or when the user wants a downstream system to receive Salesforce data changes; or when the user touches .platformEventChannelMember-meta.xml / .platformEventChannel-meta.xml files. SKIP when publishing platform events, Pub/Sub API or REST/SOAP (use integration-connectivity-generate), or ManagedEventSubscription (out of scope for CDC). Always use this skill for CDC channel-membership metadata." metadata: version: "1.0" domains: ["Integration"] minApiVersion: "60.0" relatedSkills: - "integration-connectivity-generate" - "platform-custom-field-generate" - "platform-custom-object-generate" - "platform-permission-set-generate" cliTools: - tool: ["sf"] semver: ">=2.0.0"

Managing Change Data Capture Enablement

Generate the metadata that subscribes Salesforce objects to Change Data Capture: PlatformEventChannelMember files for the default ChangeEvents channel or a custom channel, and PlatformEventChannel files for new custom channels. Covers enrichment fields, filter expressions, and the canonical naming and value formats that the Metadata API actually accepts (which differ from values that appear in many internal test fixtures and code-search hits).

Scope

  • In scope: Generating PlatformEventChannelMember and PlatformEventChannel metadata for CDC. Subscribing standard objects, custom objects, or both. Configuring enrichment fields. Configuring filter expressions. Defining custom data channels.
  • Out of scope: Publishing custom platform events (PE) — that's a different metadata type (PlatformEvent). Pub/Sub API or external Kafka/Bayeux configuration. Pricing/limits guidance — refer the user to the CDC Developer Guide. Programmatic event-bus subscribers in Apex.

Clarifying Questions

Before generating, confirm with the user if not already clear:

  • Which entity (or entities) need CDC enablement? Standard, custom, or both?
  • Default channel (ChangeEvents) or a custom channel? If custom, what's the channel label?
  • Any enrichment fields needed? (Lookup IDs that the consumer needs even when they didn't change.)
  • Any filter expression needed? (A SOQL-WHERE-clause body that gates which change events emit.)

Required Inputs

Gather or infer before proceeding:

  • Source entity API name(s) — e.g. Account, Lead, Order__c. The skill internally translates this to the ChangeEvent entity name (see Workflow step 2).
  • Channel — either ChangeEvents (default) or the developer name of a custom channel ending in __chn.
  • Enrichment fields (optional) — list of field API names on the source object whose values should be included in every change event.
  • Filter expression (optional) — a predicate over fields on the change event payload (e.g. Status__c != null).

Defaults unless specified:

  • Channel: ChangeEvents (the default CDC channel — no path prefix).
  • Enrichment fields: none.
  • Filter expression: none.

If the user provides a clear, complete request, generate immediately without unnecessary back-and-forth.


Workflow

All steps are sequential. Do not skip or reorder.

Before generating anything, know the only valid CDC metadata types: CDC is expressed entirely through PlatformEventChannelMember (one per subscribed entity) and PlatformEventChannel (only for custom channels). Do NOT use <ChangeDataCapture>, .changeDataCapture-meta.xml, changeDataCapture/ directories, EnableChangeDataCapture, or ManagedEventSubscription — these are not in scope for CDC. If you find yourself writing any of them, stop and use a PlatformEventChannelMember file instead.

  1. Identify the channel — if the user names a custom channel, you'll generate a PlatformEventChannel file (see step 4). Otherwise use the literal value ChangeEvents for the default channel.

  2. Translate source entity to ChangeEvent entity name — <selectedEntity> is the ChangeEvent type, NOT the source object:

    Source object<selectedEntity> value
    AccountAccountChangeEvent
    LeadLeadChangeEvent
    ContactContactChangeEvent
    Order__c (custom)Order__ChangeEvent
    MyThing__c (custom)MyThing__ChangeEvent

    For standard objects: append ChangeEvent. For custom objects: replace the trailing __c with __ChangeEvent (the double-underscore is preserved).

  3. Generate the channel-member file — one file per (entity, channel) pair. The filename and fullName always use a SINGLE underscore between the entity stem and ChangeEvent — this is independent of how selectedEntity is formatted in the XML body. For custom objects, drop the __c from the source name when forming the filename:

    Source objectFilename (and fullName)<selectedEntity> (in XML)
    AccountAccount_ChangeEvent.platformEventChannelMember-meta.xmlAccountChangeEvent
    LeadLead_ChangeEvent.platformEventChannelMember-meta.xmlLeadChangeEvent
    Order__cOrder_ChangeEvent.platformEventChannelMember-meta.xml (NOT Order__ChangeEvent)Order__ChangeEvent
    MyThing__cMyThing_ChangeEvent.platformEventChannelMember-meta.xml (NOT MyThing__ChangeEvent)MyThing__ChangeEvent

    The custom-object case is the easiest place to slip — the filename uses single underscore, the selectedEntity keeps its double underscore. Read assets/PlatformEventChannelMember-template.xml as the structural template.

  4. For a custom channel, generate a PlatformEventChannel file — required if any member references a non-default channel. Derive a DeveloperName from the user's label: strip spaces and non-alphanumeric characters, convert to CamelCase, then always append the literal suffix __chn. The filename and the channel's <eventChannel> reference must use this exact form, otherwise the deploy fails with Invalid channel name:

    User saysDeveloperNameFilename
    Partner SyncPartnerSync__chnPartnerSync__chn.platformEventChannel-meta.xml (NOT Partner_Sync... or PartnerSync...)
    Order UpdatesOrderUpdates__chnOrderUpdates__chn.platformEventChannel-meta.xml
    data syncDataSync__chnDataSync__chn.platformEventChannel-meta.xml

    Members on this channel reference it by the same DeveloperName: <eventChannel>PartnerSync__chn</eventChannel>. Read assets/PlatformEventChannel-template.xml.

  5. Add enrichment fields if requested — repeat the <enrichedFields><name>FIELD_API_NAME</name></enrichedFields> block for each field. The name must be a single-hop API name on the source entity — verified working with: standard lookup IDs (OwnerId, ParentId), custom lookup fields (MyLookup__c), and custom non-relationship fields (Region__c, Status__c). Relationship traversals like Owner.Name or Parent.Account.Industry are rejected by deploy with "The selected field, X.Y, isn't valid".

  6. Add a filter expression if requested — wrap the predicate in <filterExpression>...</filterExpression>. The body is a WHERE-clause body without the WHERE keyword (e.g. Status__c != null, not WHERE Status__c != null). For supported operators, field types, and pitfalls, read references/filter-expressions.md.


Rules / Constraints

ConstraintRationale
<selectedEntity> is the ChangeEvent type name, not the source object nameThe Metadata API binds the member to a ChangeEvent entity — passing Account directly fails with "invalid event in selectedEntity".
Member fullName uses single underscore: Account_ChangeEventThe double-underscore form (Account__ChangeEvent) is parsed as <namespace>__<name> and rejected: "Cannot create a new component with the namespace: Account".
Default channel value is exactly ChangeEvents — no path prefixOlder fixtures and some docs show data/ChangeEvents; the deploy returns "Unable to find the specified channel" for that value.
Enrichment field names are single-hop API names on the source entityStandard (OwnerId), custom lookup (MyLookup__c), and custom non-relationship (Region__c) all validate. Traversals like Owner.Name are rejected: "The selected field, X.Y, isn't valid".
<filterExpression> body has no WHERE keywordDeploy returns "filter expression has syntax errors: unexpected token: 'WHERE'".
Filter cannot reference IsDeleted or do relationship traversal (Owner.Username)Deploy rejects with "field is invalid".
DateTime fields support only equality in filters (=, !=) — not < / >Deploy returns "Only equality operators are supported for this field type or value". Use a named date literal: LastModifiedDate = TODAY.
Filter RHS must be a literal — no field-to-field comparisonBillingCity = ShippingCity returns "unexpected token: 'ShippingCity'".
Compound fields (e.g. BillingAddress) require dotted component access in filterBillingAddress.City = 'X' deploys; flat BillingCity is rejected as "field is invalid"; raw BillingAddress is rejected as "has to be used with a component field". Note this is the OPPOSITE of <enrichedFields>, which uses flat names.
Custom channel filename ends with __chn before the meta-xml suffixSalesforce's MDAPI naming convention; mismatch causes deploy ambiguity.
Custom channel XML must include <channelType>data</channelType>Without data, the channel is rejected for CDC (other types exist for streaming/event channels).
Source custom objects must already exist (or be deployed in the same transaction)The ChangeEvent entity for Foo__c doesn't exist until Foo__c does; member deploy fails otherwise.
Never generate a PlatformEventChannel file for the default ChangeEvents channelThe default channel is system-provided. Reference it via <eventChannel>ChangeEvents</eventChannel> on members, but only custom (__chn) channels need a channel-meta file.
PlatformEventChannelMember accepts ONLY four elements: <enrichedFields>, <eventChannel>, <filterExpression>, <selectedEntity>Adding <description>, <isActive>, <masterLabel>, or any other element fails XML schema validation: "Element {...} invalid at this location". Stick to the four documented elements.
PlatformEventChannel accepts ONLY two elements: <channelType> and <label>Adding <masterLabel>, <description>, etc. produces "Element {...}masterLabel invalid at this location in type PlatformEventChannel". Use <label>, not <masterLabel>.
Generated metadata files only — never run sf project deploy start from this skillThis skill produces artifacts; deployment is a separate lifecycle concern.

Gotchas

IssueResolution
Unable to find the specified channelSet <eventChannel>ChangeEvents</eventChannel> (no data/ prefix).
The PlatformEventChannelMember can't be created because it references an invalid event in the "selectedEntity" fieldUse the ChangeEvent name, not the source object: AccountChangeEvent, not Account.
Cannot create a new component with the namespace: <Object>Rename the file to use a single underscore: Account_ChangeEvent..., not Account__ChangeEvent....
The selected field, X.Y, isn't valid (in <enrichedFields>)Replace Owner.Name with OwnerId. CDC enriches the lookup automatically; only single-hop field API names validate.
filter expression has syntax errors: unexpected token: 'WHERE'Remove the WHERE keyword. The body is the predicate only.
The BillingCity field in the filter expression is invalid (or any flat Address component)Use the compound dotted form: BillingAddress.City, not BillingCity. See references/filter-expressions.md for the full compound-field matrix.
Custom-object member fails with "ChangeEvent doesn't exist"The source object isn't deployed yet. Ensure the Foo__c object metadata is in the same deploy or already in the org.
DUPLICATE_VALUE on second deployThe member is already subscribed. Either delete first or skip — CDC doesn't support upsert on members directly.
sf infra error (TypeInferenceError, DeployMetadata): Could not infer a metadata type for a .changeDataCapture-meta.xml fileThat file extension and metadata type don't exist. Replace the changeDataCapture/<Entity>.changeDataCapture-meta.xml file with a platformEventChannelMembers/<Entity>_ChangeEvent.platformEventChannelMember-meta.xml file.
User says "subscribe Order__c" but means standard OrderConfirm — OrderChangeEvent (standard) and Order__ChangeEvent (custom) are different entities.

Output Expectations

Deliverables:

  • One force-app/.../platformEventChannelMembers/<Entity>_ChangeEvent.platformEventChannelMember-meta.xml per subscribed entity.
  • One force-app/.../platformEventChannels/<DevName>__chn.platformEventChannel-meta.xml per custom channel (if any).

File structure follows the templates in assets/.

After receiving the generated files, the user can verify them with sf project deploy start --dry-run -d <path> --target-org <alias> before deploying. If a dry-run surfaces an unfamiliar error, references/deploy-troubleshooting.md maps the common deploy errors to their metadata-side fixes.


Cross-Skill Integration

NeedDelegate to
Generate the source custom objectplatform-custom-object-generate skill
Generate custom fields referenced by enrichment or filterplatform-custom-field-generate skill
Build a permission set for users who consume change eventsplatform-permission-set-generate skill

Reference File Index

FileWhen to read
assets/PlatformEventChannelMember-template.xmlStep 3 — starting structure for a channel member
assets/PlatformEventChannel-template.xmlStep 4 — starting structure for a custom channel
references/filter-expressions.mdStep 6 — for the supported operators and field-type matrix when writing a filter expression
references/deploy-troubleshooting.mdWhen a user reports a dry-run deploy error and asks for help diagnosing it

Related skills

More from forcedotcom/sf-skills and the wider catalog.

INintegration-eventing-subscription-configure logo

integration-eventing-subscription-configure

forcedotcom/sf-skills

Create, read, update, and delete ManagedEventSubscription metadata for Salesforce platform event subscriptions.

5.1k installsAudited
INinvestigating-agentforce-architecture logo

investigating-agentforce-architecture

forcedotcom/sf-skills

Declared architecture snapshot for one Agentforce agent: planner, topics, actions, flows, Apex, prompt templates, and NGA plugins. Renders a human-readable architecture document and Mermaid invocation graph from design-time metadata (not runtime audit rows). TRIGGER when user asks to describe, diagram, inventory, audit, document, or diff (e.g. v3 vs v5) the architecture / action tree / topic structure / tool inventory of a specific agent by agent API name in a specific org. DO NOT TRIGGER for runtime session traces, conversation transcripts, generation timings, or gateway audit chains — this skill reads design-time metadata only (use investigating-agentforce-d360 for session traces).

836 installs
INinvestigating-agentforce-d360 logo

investigating-agentforce-d360

forcedotcom/sf-skills

Data Cloud 360° view of a single Agentforce session. TRIGGER when user asks to trace, inspect, summarize, or describe a specific Agentforce session by session id (Agent Session UUID `019d…` or MessagingSession id `0Mw…`). Also triggers on session discovery — find/list/search sessions by time, agent, channel, outcome, or conversation text — when the user has no session id yet. DO NOT TRIGGER for design-time architecture questions (use investigating-agentforce-architecture instead) or for runtime perf/latency/SLO questions that require platform telemetry beyond Data Cloud.

822 installs
MAmanaging-managed-event-subscription logo

managing-managed-event-subscription

forcedotcom/sf-skills

Create, read, update, and delete ManagedEventSubscription metadata in Salesforce. Use this skill for any work involving managed event subscriptions, platform event subscriptions, event channel subscribers, or .managedEventSubscription-meta.xml files. TRIGGER when: user asks to subscribe to a platform event, create a managed subscription, set up event replay, configure an event channel subscriber, update replay preset, activate or deactivate a subscription, delete a subscription, or manage ManagedEventSubscription metadata. SKIP when: user needs to create the platform event channel itself (use generating-platform-event skill) or needs Flow-based event subscriptions (use generating-flow skill).

820 installsAudited
MOmobile-apps-create logo

mobile-apps-create

forcedotcom/sf-skills

Route Salesforce mobile app projects to the right SDK: Mobile SDK for data-driven apps, Agentforce SDK for agent-first experiences.

4.7k installs
MOmobile-platform-native-capabilities-integrate logo

mobile-platform-native-capabilities-integrate

forcedotcom/sf-skills

Integrate native mobile device capabilities (barcode, biometrics, location, NFC, payments) into Salesforce LWCs.

4.7k installs