Thursday, November 26, 2026

Commerce Data Exchange (CDX) Seed Data Extension - transfer new fields or tables from HQ to POS

 

POS doesn't read the headquarters database. It reads a separate channel database at the store or in the cloud scale unit. Commerce Data Exchange (CDX) copies data from HQ to that database using numbered distribution jobs, such as 1070 and 1110. CDX only copies the tables and fields that its "seed data" tells it about, and that list knows nothing about your new table or field. Therefore, we need to add a resource and a event handler class to extend the seed data.



The two pieces

PieceTypeWhat it does
ContosoRetailCDXSeedDataAX7Resource (XML file)Says what to send, where it goes in the channel database, and which job sends it
ContosoRetailCDXSeedDataEventHandlerClassAdds 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.

xml
<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 (ContosoSerialNumberPattern) copies the whole pattern table (ID, description, pattern) to ext.ContosoSERIALNUMBERPATTERN with job 1070. Job 1070 already sends channel configuration, so new patterns reach the stores with it.
  • Subjob 2 (ContosoRetailParameters) copies the standard RetailParameters table. It only takes Key, DataAreaId, the new ContosoSerialValidationAttribute field and RecId, and writes them to ext.ContosoRETAILPARAMETERS with job 1110. This is how the store knows which product attribute is the "Validate attribute".

Step 2: The event handler registers the resource.

xpp
[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 RetailCDXSeedDataBase raises the delegate registerCDXSeedDataExtension. A delegate is an extension point that other code can subscribe to.
  • _originalCDXSeedDataResource names the standard seed data being processed. The if makes 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:

  1. Reads the standard seed data and raises the delegate. Your handler adds your resource at this point.
  2. Creates the subjobs ContosoSerialNumberPattern and ContosoRetailParameters with their field mappings.
  3. 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:

  1. Reads ContosoSerialNumberPattern in HQ.
  2. Packages the rows into a download session.
  3. Writes them into ext.ContosoSERIALNUMBERPATTERN in 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

  1. The target table must already exist. The ext.ContosoSERIALNUMBERPATTERN and ext.ContosoRETAILPARAMETERS tables come from the SQL script in the channel database project. If they're missing, the download session fails with status "Failed" or "Error".
  2. Column names must match exactly. The SQL columns must be PATTERNID, DESCRIPTION, PATTERN and RECID, matching the field names in the resource.
  3. RecId is required. CDX uses it as the key to update or replace rows.
  4. For the parameters, Key and DataAreaId are needed. RetailParameters has one row per legal entity. The store finds its own company's row by DataAreaId.
  5. Run Initialize again after every change to the resource XML. Otherwise the scheduler keeps the old definition.

Example of the resource file ContosoRetailCDXSeedDataAX7

<RetailCdxSeedData ChannelDBMajorVersion="7" ChannelDBSchema="ext" Name="AX7">
  <Subjobs>
    <!-- new pattern table, distributed with job 1070 (Channel configuration) -->
    <Subjob Id="ContosoSerialNumberPattern" TargetTableSchema="ext" TargetTableName="ContosoSERIALNUMBERPATTERN" AxTableName="ContosoSerialNumberPattern">
      <ScheduledByJobs>
        <ScheduledByJob>1070</ScheduledByJob>
      </ScheduledByJobs>
      <AxFields>
        <Field Name="PatternId" />
        <Field Name="Description" />
        <Field Name="Pattern" />
        <Field Name="RecId" />
      </AxFields>
    </Subjob>
    <!-- new field in RetailParameters table.Confirm the job that distributes RetailParameters in the scheduler (normally 1110). -->
    <Subjob Id="ContosoRetailParameters" TargetTableSchema="ext" TargetTableName="ContosoRETAILPARAMETERS" AxTableName="RetailParameters">
      <ScheduledByJobs>
        <ScheduledByJob>1110</ScheduledByJob>
      </ScheduledByJobs>
      <AxFields>
        <Field Name="Key" />
        <Field Name="DataAreaId" />
        <Field Name="ContosoSerialValidationAttribute" />
        <Field Name="RecId" />
      </AxFields>
    </Subjob>
  </Subjobs>
</RetailCdxSeedData>

Friday, November 20, 2026

Map Git Repository in D365 FO development environment

These are steps that you need to set up before developing your first D365 FO project:

1. Clone the Git Repository, exp: in drive C in your pc.

2. Link the cloned models with the models under the PackagesLocalDirectory: open cmd and run the below command:

mklink /D K:\AosService\PackagesLocalDirectory<ModelName> C:\Users\aaa\Documents\src\xplusplus\models<ModelName>



3. Open VS and build custom models with Sync DB option 



Now you can create your project under the project folder in the cloned repository (ex: C:\D365\src\xpp\projects) and it will be mapped to the PackagesLocalDirectory.

Thursday, March 13, 2025

Import an ISV licese file into Dev environment using Power Shell

 K:\AOSService\PackagesLocalDirectory\Bin\Microsoft.Dynamics.AX.Deployment.Setup.exe --setupmode importlicensefile --metadatadir K:\aosservice\PackagesLocalDirectory --bindir K:\aosservice\PackagesLocalDirectory --sqlserver . --sqldatabase axdb --sqluser axdbadmin --sqlpwd *** --licensefilename "C:\Temp\A.txt"

Wednesday, March 12, 2025

Apply an ISV package on a Dev environment

 1. Upload the compressed package to LCS > Asset Library > Software deployable package

 2. Go to Dev environment > Maintain > Apply updates > select the package


3. After the update complete, open VS > Source Control Explorer > expand the dev branch > Metadata > choose the isv package folder > you can see the editted files


4. Click on "Add to Source Control" button to add newly created items (if any) > select both Bin & Resources folder 


5. 

6. Check in pending changes
7. Merge to other branches (if any)











Monday, July 8, 2024

Debug in a Tier-2 (UAT) environment

 From time to time, you may have to debug a copy of the production database, but you are unable to export & import the DB to your dev machine, for example: the DB's size is too large, or it's an urgent issue, or the customer doesn't allow to export their Prod DB... Then you have to debug directly in the UAT environment. 

There is an article from Microsoft that describes briefly about this here, but there is no screenshot and the information isn't detailed enough, so the purpose of this post is to guide you step by step to achive this :)

1. Find your ip address at https://nordvpn.com/what-is-my-ip/ and note it down  



2. Enable just-in-time database access

Go to LCS > Select the Tier 2 environment > Maintain > Enable access



Add your IP address in step 1: click on + button, then enter your IP as below: 


Click "Confirm" button at the bottom and then you can see a new record is added with your IP info.

Then under the Manage Environment, choose "Performance tuning for AX (write to AX)" as the "Reason for access" and write some descriptions and then click on "Request Access"


After that, refresh the page and you will see the login details under the Database Accounts


3. Change web.config in your DEV environment

In your DEV environment, backup the original web.config file at K:\AosService\WebRoot




Reference: https://stoneridgesoftware.com/how-to-connect-your-dev-and-uat-environments-in-dynamics-365-finance-and-operations/








Thursday, November 23, 2023

Set up Onebox VM for D365 FO with non-organization microsoft account

With the release of the new VHD 10.0.37, I have tried to create a Onebox VM in my laptop instead of using the cloud hosted environment and found the below articles really helpful to setup the VM with my private Microsoft account:

https://alexdmeyer.com/2023/07/05/step-by-step-guide-to-deploy-a-local-vhd-of-d365fo/

https://community.dynamics.com/forums/thread/details/?threadid=01455e69-5d7e-4896-b2c6-673a49b28bfa


Thursday, October 19, 2023

Optimization advisor in D365 FO

 https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/fin-ops/sysadmin/optimization-advisor-overview


Commerce Data Exchange (CDX) Seed Data Extension - transfer new fields or tables from HQ to POS

  POS doesn't read the headquarters database. It reads a separate channel database at the store or in the cloud scale unit. Commerce Dat...