This article explains:
How to resolve data import error for Microsoft Dynamics AX 2012 using Office Add-ins. This error happens when you try to import data from excel to Dynamics AX.
Microsoft Dynamics AX 2012 CU2.
When you try to import data for LogisticsAddressCity, LogisticsAddressZipCode, LogisticsAddressState etc. you get an error “Cannot load [LogisticsAddressCity]. Tables must have a valid replacement key or a primary index other than RecID for use in Office Add-ins”.
The main reason of this error is missing of primary index which is responsible for unique record in your table.
Step 1: Open your AX client and go the AOT / Data Dictionary / Tables then LogisticsAddressCity table.
Step 2: Go the indexes of above mentioned table and create a new index.
Step 3: Assign fields CountryRegionId, Name and RecId to this new index. Save your work. Here CountryRegionId and Name both are mandatory fields for this table so added in primary index and additionally RecId has been added to make the record unique in the table.
Step 4: Select newly created index and go to property of the index. Set property for Allow Duplicates = No; Alternate Key = Yes
Step 5: Save your work and select table LogisticsAddresssCity. Go to property of this table and set newly created index to Replacement Key property. Save your work.
Please repeat step 2 to 5 for other tables you got error. Select mandatory fields and RecId in their index.
Step 6: Right click on these tables and synchronize them one by one.
Step 7: Select all these customized tables and generate CIL. You can use Ctrl + Shift + F7 to generate CIL for selected tables. If CIL is generated correctly you will get output messages like: Finished Pass 1 at [date & time], Finished Pass 2 at [date & time], Finished Pass 3 at [date & time].
Step 8: Once all these are done, restart your application AOS. Once the AOS is restarted, run your AX client and try to import data.
Hope this will resolve your problem.
Happy learning 🙂
NOTE: Use at your own risk. There is no warranty on this article.