Newer Version Available

This content describes an older version of this product. View Latest

PlatformEventChannel

Represents a custom channel that you can subscribe to in order to receive a stream of change data capture events.

This object is available in API version 47.0 and later.

Supported SOAP Calls

create(), delete(), describeSObjects(), query(), retrieve(), update(), upsert()

Supported REST HTTP Methods

DELETE, GET, HEAD, PATCH, POST, Query

Special Access Rules

  • To retrieve or query this object, you must have the View Setup and Configuration permission.
  • To create, update, or delete this object, you must have the Customize Application permission.

Fields

Field Name Description
ChannelType
Type
picklist
Properties
Filter, Group, Restricted picklist, Sort
Description
Required. The channel type. Valid values are:
  • data—Change Data Capture channel corresponding to the selected entities.
  • event—A channel that contains platform events.
DeveloperName
Type
string
Properties
Filter, Group, Sort
Description
The unique name for the PlatformEventChannel object. The developer name doesn’t include the __chn custom channel suffix. For example, the developer name of the MyChannel__chn custom channel is MyChannel.
This name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores. This field is automatically generated, but you can supply your own value if you create the record using the API.
  • When creating large sets of data, always specify a unique DeveloperName for each record. If no DeveloperName is specified, performance slows down while Salesforce generates one for each record.
  • Only users with View DeveloperName OR View Setup and Configuration permission can view, group, sort, and filter this field.

Note

EventType
Type
picklist
Properties
Filter, Group, Nillable, Restricted picklist, Sort
Description
The type of events that the channel can hold. A channel can hold only one type of events. Use this field to optionally specify a specific type of events for a channel in combination with the ChannelType field. Valid values are:
  • custom—The channel contains custom platform events. This value is valid with the channelType of event.
  • data—The channel contains change data capture events. This value is valid with the channelType of data.
  • monitoring—The channel contains Real-Time Event Monitoring events. This value is valid with the channelType of event.
  • standard—Reserved for internal use.

Available in API version 61.0 and later.

FullName
Type
string
Properties
Create, Group, Nillable
Description
The full name of the associated PlatformEventChannel in Metadata API. The full name can include a namespace prefix. The full name includes the __chn custom channel suffix. For example, the full name of the MyChannel custom channel is MyChannel__chn.
Query this field only if the query result contains no more than one record. Otherwise, an error is returned. If more than one record exists, use multiple queries to retrieve the records. This limit protects performance.
Language
Type
picklist
Properties
Defaulted on create, Filter, Group, Nillable, Restricted picklist, Sort
Description
The language of the MasterLabel.
ManageableState
Type
ManageableState enumerated list
Properties
Filter, Group, Nillable, Restricted picklist, Sort
Description
Indicates the manageable state of the specified component that is contained in a package:
  • beta
  • deleted
  • deprecated
  • deprecatedEditable
  • installed
  • installedEditable
  • released
  • unmanaged
MasterLabel
Type
string
Properties
Filter, Group, Sort
Description
The channel label. The label of this field is Label.
Metadata
Type
complexvalue
Properties
Create, Nillable, Update
Description
Platform event channel metadata.
Query this field only if the query result contains no more than one record. Otherwise, an error is returned. If more than one record exists, use multiple queries to retrieve the records. This limit protects performance.
NamespacePrefix
Type
string
Properties
Filter, Group, Nillable, Sort
Description
The namespace prefix that is associated with this object. Each Developer Edition org that creates a managed package has a unique namespace prefix. Limit: 15 characters. You can refer to a component in a managed package by using the namespacePrefix__componentName notation.

The namespace prefix can have one of the following values.

  • In Developer Edition orgs, NamespacePrefix is set to the namespace prefix of the org for all objects that support it, unless an object is in an installed managed package. In that case, the object has the namespace prefix of the installed managed package. This field’s value is the namespace prefix of the Developer Edition org of the package developer.
  • In orgs that are not Developer Edition orgs, NamespacePrefix is set only for objects that are part of an installed managed package. All other objects have no namespace prefix.

Usage

This JSON example is the body of a REST API POST request that creates the SalesEvents__chn custom channel. The corresponding REST endpoint is /services/data/v65.0/tooling/sobjects/PlatformEventChannel.

1{
2  "FullName": "SalesEvents__chn",
3  "Metadata": {
4    "channelType": "data",
5    "label": "My Custom Channel"
6  }
7}
  • You can update only the FullName field and the metadata label field of a PlatformEventChannel.
  • If you delete a PlatformEventChannel, all its member PlatformEventChannelMember components are also deleted.

Note

You can query custom channels in SOQL over Tooling API but not the standard channel (ChangeEvents). For example, this query returns fields of channel members from all custom channels.

1SELECT Id, DeveloperName, ChannelType, MasterLabel FROM PlatformEventChannel