Categories
Dynamics Ax Programming Technical

Dynamics ax a key with the name %1 already exists

Today I had to fix a bug in some custom code in Dynamics Ax 2009, we had an error from the JournalTransList class that stated “A key with the name %1 already exists.”

  • Cause: A custom field on the WMSJournalTrans table that was extending from LineNum
  • Reason: The JournalTransList has methods to check if the primary index on the actual table won’t be violated, therefore it seems to look for all fields that extend from LineNum.
  • Solution: Create you’re custom EDT that extends from LineNum and add that one to the table, it’s a best practice but who thought this could be so critical :p

4 replies on “Dynamics ax a key with the name %1 already exists”

Thanks a million! This problem still exists in Microsoft Dynamics 365 for Finance and Operations. I used steps to solve for another client as well.

Hi Kevin,

Thanks a ton. this really save me hours of debugging. i have custom fields on prod journal bom and same scenario. Just change the edt and and error go way. i never thought this would be the reason.

Leave a Reply to Hammad Khan Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.