The K3 Technical Blog provides expert advice in Microsoft Dynamics AX specializing in the Retail sector. Our team of bloggers are all Microsoft Dynamics AX professionals with first hand experience in Microsoft Dynamics AX implementations in Retail.
k3 have added custom inventory dimensions to the InventDim table, which was fine, until we upgraded to Microsoft Dynamics AX 2012 R2. Microsoft has introduced some new inventory dimensions for Russia and SQL Server has a limitation of 16 fields on an index. The result being we have not been able to add the new dimensions to the index on the table, as there are now too many fields on the index to satisfy SQL Server; until we discovered a new framework that Microsoft call “Stock Dimensions Extensibility”.
I came across the following blog, which pointed me in the right direction.
Below are the steps I took to fix the issue:
1. Remove least used fields from the index. I removed InventOwnerId_RU and InventProfileId_RU.
2. This enabled me to add the index for my new dimension without exeeding the 16 field limit.
3. On the inventDim table, in the HashKey() method, add the fields you have removed from the index (as below)
/// Calculates the string that is used when the hash value is calculated for the dimension values that
/// are not included in the DimIdx index.
/// A string that contains the calculated hash value.
public str hashKey()
str hashKey = '';
SQL Server has a limitation of 16 fields in one index. For InventDim this is a problem if extra dimensions are added in an installation.
Instead we have added a new field which can store hashed values of the least used dimensions.
The class InventDimUniquenessEnabling can be used to validate if the proper indexes are defined and this method includes the right fields.
Create a string this is unique for every combination of the dimensions. This can for example be achieved by using the code pattern below for each field included in the hash.
hashKey += (hashKey ? '~' : '') + ':' + this.;
hashKey += (hashKey ? '~' : '') + 'InventOwnerId_RU:' + this.InventOwnerId_RU;
hashKey += (hashKey ? '~' : '') + 'InventProfileId_RU:' + this.InventProfileId_RU;
4. To make this work, it needs to have the Stock Dimensions Extensibility configuration key switched on which can be found under:
System Administration –> Setup up –> Licensing –> License Configuration –> Trade –> Stock Dimensions Extensibility
5. To make sure this configuration key was always turned on, I altered the closeOK() method on the SystemConfiguration Form as follows:
if (apply.enabled() == false)
error("The Trade > Stock Dimension Extensibility configuration key must be enabled");
This solution should now allow you to add extra dimensions onto the InventDim table, without coming across problems concerning too many fields on the index.
Other Microsoft Sites
I'm a Customer
I'm a Partner
Follow Microsoft Dynamics