I faced a very strange error two times so far saying that there is date2StrUsr function:
“The wrong number of arguments has been specified for the function”
and on the base enum DateFlags:
“The enumeration does not exist on DateFlags base enum”.
Actually this has happened due to some “crash” in the SP1 of Microsoft Dynamics AX 2009. DateFlags and date2StrUsr with the new arguments have been added to SP1 of Dynamics AX 2009.
I still do not know what the cause of this error is. The two times I have faced this problem were on two different clients where those clients were in the system configuration phase and some data were imported already. So before this error came up, there were using the system with the SP1 installed just perfectly.
Anyway, in order to solve the problem.. you simply have to uninstall the AOS only.. restart your server, re-install it again with the same name you were specifying as an AOS name.
I’m listing here the steps of how you do that in a safe manner. You might not go through them, but if you’re system is up and running and contains data that you don’t want to lose.. do the following:
- Stop the AOS service
- Backup your DB in case you something went wrong (you never know)
- Install a new another AOS instance, DB and Application Files for testing purposes (you don’t need to start the service here)
- Install SP1 on the new AOS and Application Files
- Run the service
- Open your Dynamics AX client on the new AOS configuration. Go with check-list steps.. most importantly: Compile and Database Synchronization (no need to import any data)
- After you’re done of the check list, go to AOT and try to compile: CurrencyExchHelper.. class. Insure that it complies with no errors. (This class uses DateFlags and date2StrUsr of SP1). If you see the same errors on this new AOS instance, then your SP1 installation went wrong. Re-install it again. You might also insure that you are using good installation files by downloading them again from PartnerSource.
- After insuring the the SP1 installation went just right, you might need to move also the customization you were doing on the old instance. So stop the service, get the customized layer like axVAR.aod for example and paste it in the new application folder.
- Run the service again, and compile the whole application by going to: Administrationà Periodic à Compile application
- Now, you need to re-install the AOS service in the same name, by:
- Uninstall the AOS from Programs and features on Windows 2008 or Add/Remove programs on Windows 2003
- Restart the machine (this is important)
- Install the AOS in the same name of the old service (do not run the service)
- Install SP1 for the new AOS
- Stop all services of Dynamics AX 2009
- Start the Microsoft Dynamics AX 2009 Server Configuration Utility and change the application Instance of the old AOS to the new application folder. Also do the same for the database (point to the new database).
- Run the Old Service.
- Open Dynamics AX client on the old configuration and go to the CurrencyExchHelper class. Compile it and insure that it shows no errors.
- Stop the service. Go to the old application folder, delete the file: axapd.aoi
- Start the Microsoft Dynamics AX 2009 Server Configuration Utility. Point the new service (with same old name) to the old database and application folder.
- Run the service.
- Terarararaaaa it runs and no compilation errors again! It is recommended that you re-compile the application again.
this error is accured when you compile any method used the base enum DateFlags from Ax Client that is not updated with SP1.
to solve it just compile the same method from ax client updated with SP1