We came across an issue where they had two separate systems with their own database and application files, dev and test, and both were being used for developing and testing custom AIF services using Microsoft Dynamics AX 4.0. In one scenario after moving AIF setup from one environment to another (dev to test), then trying to run “scan and register” from Basic\Setup\Applicaiton Integration Framework\Action form, produced a couple of errors:
Cannot create a record in Data Policy Schema Information (AifDocumentField). Document Class ID: 40174, /CUSTOM_AxdWMSJournal/CUSTOM_AIFWMSJourTable/CUSTOM_HaulierName. The record already exists.
Document name (AifServiceable.getName()) CUSTOM_AxdVendPaymMode in AifServiceable class AxdCUSTOM_AxdVendPaymMode must be unique across all AifServiceable classes.
The above errors occurred because the classes were imported WITHOUT id values from the xpo files and this broke the ID references in the related AIF records. Importing back with id values does not resolve the issue.
Since the ID references were broken we manually worked around the issue to get past the two errors on the test system as follows:
(1) For the error: Document name (AifServiceable.getName()) CUSTOM_AxdVendPaymMode in AifServiceable class AxdCUSTOM_AxdVendPaymMode must be unique across all AifServiceable classes, we worked around as follows:
This error is caused when an existing document class’s ID has been changed. This means there’s an old record in Tables\AifDocumentSchemaTable which needs to be cleared out. We searched the table for the document name and we found a record which had the same name but a different ClassId – one that no longer existed. So we deleted it and run “scan and register” again.
NOTE: Do not try to rename the classid on this record as that will just lead to further errors – it must be deleted.
(2) . For the error: Cannot create a record in Data Policy Schema Information (AifDocumentField). Document Class ID: 40174, /CUSTOM_AxdWMSJournal/CUSTOM_AIFWMSJourTable/CUSTOM_HaulierName. The record already exists. We worked around this error as follows:
This error is caused because there is another unique index on AifDocumentField on RecId, and AX is trying to assign a RecId which already exists, hence the error. Further testing actually showed that it was impossible to insert any record to this table even when using a simple X++ job. Checking the SystemSequences table (the source of all RecIds) we found that there were records in their for AifDocumentField (tabid=805) for every company, when it’s not a company specific table. To workaround this particular instance knowing its a test site we cleared all records except for the one where dataareaid=’dat’. Then we checked what the maximum RecId actually was set to in the table, and then updated the nextval in systemsequences to the number after the max value. Finally we had to had to restart the AOS (as systemSequences is cached in there), and running the scan and register again, all of the errors were resolved.
We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!