InventDimID not specified error while importing data using data entity – New Dynamics AX RTW[AX7]

Recently while working on data import using data entity in AX7 or new Dynamics AX RTW, I have faced an error in my custom built data entity . I have created a new data entity for importing the Item GTIN codes which has a field called InventDimId and have foreign key relation with InventDim table. My data entiy has a very basic design. It has only one table in data source and InventDimId is not even selected as  data entity field as you can see below picture.


Everthing was as per the Microsoft guidelines but still while importing the data I got an error “InventDimId” is not specified, even after assigning the value through code or through data file I got a different error “InventDimId” is read only and that creats a frutstration what is wrong. After deep digging and looking some standard Microsoft provided data entity I found the solution and here are the steps to fix it.

  1. First create a new data source with table “InventDim” under your primary data source in my case I have created new data source under “InventGTIN” and link both using relationshio “InventDim” as you can see here.Fixed data source
  2. Next is to override a standard method called “mapEntityToDatasource” in your data entity and write below code in that method

Method override

public void mapEntityToDataSource(DataEntityRuntimeContext _entityCtx, 
DataEntityDataSourceRuntimeContext _dataSourceCtx)
   super(_entityCtx, _dataSourceCtx);
   switch (
      case dataEntityDataSourceStr(SalesOpenSalesPriceJournalLineEntity,
         InventDim inventDim = this.InventInventoryDimensionEntityFieldsMapping::resolveInventDim();_dataSourceCtx.setBuffer(inventDim);

save your changes and update your staging table for data entity and that’s it.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s