InventDim fields on Data Entities

To import inventory dimension fields, Microsoft has implemented a map called “InventInventoryDimensionEntityFieldsMapping” which can be used in Data Entity mappings. This map needs to be added to the Data Entity under “Mappings” node and the fields between the map and the Data Entity fields need to be mapped accordingly.

Note: Not the fields of the datasource need to be mapped, but the Data Entity fields itselves. This means that you first need to include the InventDim table as a datasource to your Data Entity and drag the needed inventory dimension fields into your Data Entity fields.

inventorymapping

Additionally, the method “mapEntityToDatasource” needs to be implemented with below code. Upon insertion or update, the specified inventory dimensions will be resolved and the InventDim record is returned.

public void mapEntityToDatasource(DataEntityRuntimeContext _entityCtx, DataEntityDatasourceRuntimeContext _dataSourceCtx)
{
    super(_entityCtx, _dataSourceCtx);

    switch (_dataSourceCtx.name())
    {
        case dataEntityDataSourceStr(SuppItemTableEntity, InventDim):
            InventDim inventDim = this.InventInventoryDimensionEntityFieldsMapping:resolveInventDim();
            _dataSourceCtx.setBuffer(inventDim);
            _dataSourceCtx.setDatabaseOperation(DataEntityDatabaseOperation:Update);
            break;
    }
}

Note: If a Data Entity involves more than one InventDim datasource (e.g. a Data Entity for the SuppItemTable table), then the mapping does not work. In this case, custom code needs to be written to map the fields correctly.

Leave a Reply

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

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s