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