Bojensen Blogs

date2StrUsr and DateFlags Error when Compiling/Interacting with Dynamics AX 2009 SP1

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:

  1. Stop the AOS service
  2. Backup your DB in case you something went wrong (you never know)
  3. Install a new another AOS instance, DB and Application Files for testing purposes (you don’t need to start the service here)
  4. Install SP1 on the new AOS and Application Files
  5. Run the service
  6. 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)
  7. 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.
  8. 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.
  9. Run the service again, and compile the whole application by going to: Administrationà Periodic à Compile application
  10. Now, you need to re-install the AOS service in the same name, by:
    1. Uninstall the AOS from Programs and features on Windows 2008 or Add/Remove programs on Windows 2003
    2. Restart the machine (this is important)
    3. Install the AOS in the same name of the old service (do not run the service)
    4. Install SP1 for the new AOS
    5. Stop all services of Dynamics AX 2009
    6. 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).
    7. Run the Old Service.
    8. Open Dynamics AX client on the old configuration and go to the CurrencyExchHelper class. Compile it and insure that it shows no errors.  
    9. Stop the service. Go to the old application folder, delete the file: axapd.aoi
    10. Start the Microsoft Dynamics AX 2009 Server Configuration Utility. Point the new service (with same old name) to the old database and application folder.
    11. Run the service.
    12. 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

date2StrUsr and DateFlags Error when Compiling/Interacting with Dynamics AX 2009 SP1 « Amer Atiyah, Microsoft Dynamics AX Solution Architect

2 comments for “date2StrUsr and DateFlags Error when Compiling/Interacting with Dynamics AX 2009 SP1