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.


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 (
        case dataEntityDataSourceStr(SuppItemTableEntity, InventDim):
            InventDim inventDim = this.InventInventoryDimensionEntityFieldsMapping:resolveInventDim();

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.

Disable editing of specific financial dimensions on form

The form control “DimensionEntryControl” has a method called “parmEditableDimensionSet” which sets only a specific dimension set as editable. Thus, by excluding financial dimensions from the dimension set, it is possible to make specific dimension not editable.

First, a dimension set storage needs to be created. After that, each financial dimension will be added to the dimension set storage excluding the dimensions which should not be editable. At the end, the dimension set storage will be passed to the mentioned parm-method “parmEditableDimensionSet” which then only sets the dimensions in the dimension set storage as editable.

Below is an example which implements the code in the form event handler “OnInitialized” to make dimension not editable upon calling a form.

[FormEventHandler(formStr(SalesTable), FormEventType:Initialized)]
public static void SalesTable_OnInitialized(xFormRun _sender, FormEventArgs _e)
    DimensionEntryControl dimControl =;
    DimensionEnumeration dimensionSetId = DimensionCache:getDimensionAttributeSetForLedger();
    DimensionAttributeSetStorage dimensionAttributeSetStorage;
    DimensionAttribute dimensionAttribute;
    DimensionAttributeSetItem dimAttrSetItem;

    const str contractNumber = 'ContractNo';
    const str contractType = 'ContractType';

    dimensionAttributeSetStorage = new DimensionAttributeSetStorage();

    while select dimensionAttribute
        where dimensionAttribute.Name != contractNumber // Exclude specific dimension which should be not editable
            && dimensionAttribute.Name != contractType // Exclude specific dimension which should be not editable
        join dimAttrSetItem
            where dimAttrSetItem.DimensionAttribute == dimensionAttribute.RecId
                && dimAttrSetItem.DimensionAttributeSet == dimensionSetId


As a result, the dimension fields “ContractNo” and “ContractType” are no longer editable on the sales order form.