The two pieces
| Piece | Type | What it does |
|---|---|---|
ContosoRetailCDXSeedDataAX7 | Resource (XML file) | Says what to send, where it goes in the channel database, and which job sends it |
ContosoRetailCDXSeedDataEventHandler | Class | Adds your XML file to the standard list so the system reads it |
The resource is the list of what to sync. The class adds that list to Microsoft's standard one.
Step by step
Step 1: The resource describes the sync. It has two subjobs. A subjob is one table copied as part of a distribution job.
<RetailCdxSeedData ChannelDBMajorVersion="7" ChannelDBSchema="ext" Name="AX7">
<Subjob Id="ContosoSerialNumberPattern" ← subjob name in the Commerce scheduler
AxTableName="ContosoSerialNumberPattern" ← source table in HQ
TargetTableSchema="ext" ← custom tables always go to the ext schema
TargetTableName="ContosoSERIALNUMBERPATTERN"> ← target table in the channel database
<ScheduledByJob>1070</ScheduledByJob> ← sent when job 1070 (channel configuration) runs
<AxFields> PatternId, Pattern, RecId </AxFields> ← only these columns are copied- Subjob 1 (Contoso
SerialNumberPattern) copies the whole pattern table (ID, description, pattern) toext.ContosoSERIALNUMBERPATTERNwith job 1070. Job 1070 already sends channel configuration, so new patterns reach the stores with it. - Subjob 2 (Contoso
RetailParameters) copies the standardRetailParameterstable. It only takesKey,DataAreaId, the new ContosoSerialValidationAttributefield andRecId, and writes them toext.ContosoRETAILPARAMETERSwith job 1110. This is how the store knows which product attribute is the "Validate attribute".
Step 2: The event handler registers the resource.
[SubscribesTo(classStr(RetailCDXSeedDataBase), delegateStr(RetailCDXSeedDataBase, registerCDXSeedDataExtension))]
public static void registerCDXSeedDataExtension(str _originalCDXSeedDataResource, List _resources)
{
if (_originalCDXSeedDataResource == classStr(RetailCDXSeedDataAX7))
{
_resources.addEnd(resourceStr(ContosoRetailCDXSeedDataAX7));
}
}- While it builds the scheduler setup, the standard class
RetailCDXSeedDataBaseraises the delegateregisterCDXSeedDataExtension. A delegate is an extension point that other code can subscribe to. _originalCDXSeedDataResourcenames the standard seed data being processed. Theifmakes sure your file is added only to the current one (RetailCDXSeedDataAX7), and only once._resources.addEnd(...)adds your XML to the list. The system then merges it with Microsoft's standard definitions.
Step 3: Initialization creates the scheduler setup. Writing the code alone does nothing. After you deploy, go to Retail and Commerce > Headquarters setup > Parameters > Commerce shared parameters (or Commerce parameters) and run Initialize, or run Configure Commerce scheduler. This step:
- Reads the standard seed data and raises the delegate. Your handler adds your resource at this point.
- Creates the subjobs Contoso
SerialNumberPatternand ContosoRetailParameterswith their field mappings. - Links them to distribution jobs 1070 and 1110.
You can check the result under Commerce scheduler > Scheduler subjobs.
Step 4: The distribution job copies the data. When job 1070 runs (on its batch schedule, or with Distribution schedule > 1070 > Run now), CDX:
- Reads Contoso
SerialNumberPatternin HQ. - Packages the rows into a download session.
- Writes them into
ext.ContosoSERIALNUMBERPATTERNin the channel database.
Job 1110 does the same for the parameter.
Step 5: The store reads the data. Your CRT trigger reads the patterns and the parameter from the ext tables locally. It doesn't call HQ at runtime, so validation also works offline if the offline database is in sync.
Things that commonly break this
- The target table must already exist. The
ext.ContosoSERIALNUMBERPATTERNandext.ContosoRETAILPARAMETERStables come from the SQL script in the channel database project. If they're missing, the download session fails with status "Failed" or "Error". - Column names must match exactly. The SQL columns must be
PATTERNID,DESCRIPTION,PATTERNandRECID, matching the field names in the resource. RecIdis required. CDX uses it as the key to update or replace rows.- For the parameters,
KeyandDataAreaIdare needed.RetailParametershas one row per legal entity. The store finds its own company's row byDataAreaId. - Run Initialize again after every change to the resource XML. Otherwise the scheduler keeps the old definition.








