Newer Version Available

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

Migrate Object Selections with Metadata API

Use the PlatformEventChannel metadata type to retrieve and deploy Change Data Capture object selections that you configured in Setup to another org.

The following is an example of a PlatformEventChannel component with the event names of three selected entities: Account, Contact, and the Employee__c custom object.

1<?xml version="1.0" encoding="UTF-8"?>
2<PlatformEventChannel xmlns="http://soap.sforce.com/2006/04/metadata">
3    <channelMembers>
4        <selectedEntity>AccountChangeEvent</selectedEntity>
5    </channelMembers>
6    <channelMembers>
7        <selectedEntity>ContactChangeEvent</selectedEntity>
8    </channelMembers>
9    <channelMembers>
10        <selectedEntity>Employee__ChangeEvent</selectedEntity>
11    </channelMembers>
12    <channelType>data</channelType>
13    <label>ChangeEvents</label>
14</PlatformEventChannel>

The following is an example package.xml that references the previous definition.

1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3    <types>
4        <members>ChangeEvents</members>
5        <name>PlatformEventChannel</name>
6    </types>
7    <version>45.0</version>
8</Package>

For more information, see PlatformEventChannel in the Metadata API Developer Guide.