31 August 2012

Best Practise Error: different origin value on a new object

I just got thie Best Pracitse Error on a newly created table in Dynamics AX 2012:

The element has an origin value that is different from the origin value in a previous version of Microsoft  Dynamics AX. 

Checks that the element had the same origin value in earlier versions of Microsoft Dynamics AX. The origin value is the beginning value of the element. This check was added due to the changes regarding installation specific IDs. 
BPErrorObjectOriginMismatch @SYS335100

I was confused about this message, cause it doesn't make any sence for new objects. After a restart of the AOS the error is gone.

30 August 2012

Set up AX 2012 to support workflows

Set up workflows in Dynamics AX 2012

Important steps to check:
  • System Administration 
    • Setup 
      • System
        • Server configuration:
          check that there is only the AOS instance that is required
          acitvate the "is batch server" flag
        • System Service Accounts
          check the Workflow execution account
      • Workflow
        • Workflow infrastructure configuration
          Click through the wizard to set up the requiered batch jobs
  • Also don't forget that workflows require CIL. So full CIL generation should be done.

Book: Inside Microsoft Dynamics AX 2012

The Book "Inside Microsoft Dynamics AX 2012" is ready for pre order at amazon.

29 August 2012

CIL Generation problems

Lately i had some trouble generating CIL. I got some Errors in standard Classes like Retail and SysQuery.

CIL-Generierung: Error 1. Class: SysQuery, Method: queryAddStaticCursorAsRangeAndValue, Exception: System.ArgumentException: Type QueryBuildStaticlink was not found in the CIL that was generated from X++.

\Classes\RetailStatementPostSalesOrders\createAggregatedSaleLines Err: 351 \Classes\RetailStatementPostSalesOrders\createSalesOrders Err: 351

These errors are logged in the CIL generation log file which is stored in the folder:
C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL with the name Dynamics.Ax.Application.dll.log

To get rid of the sysQuery error the following steps did the trick:
  1. Compile SysQuery Class 
  2. Start Full CIL Generation 
When these steps doesn't solve the problem another option is to deleter CIL Files and restart Full CiL:

  1. Stop the AOS
  2. Delete files in this folder C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL\source
  3. Start the AOS again
  4. Start full CIL generation

21 August 2012

Difference between two dates in days

To get the difference between two dates in dynamics ax just convert the dates into numbers and subtract one from the other. The result would be the amount of days between these dates.

days = date2num(Date123) - date2num(Date234);

To get the difference between two DateTime Values just use the DateTimeUtil Class. The result is the difference in seconds. So just divide these through #secondsPerDay and you'll get the days


days = DateTimeutil::getDifference(DateTime123, DateTime234) / #secondsPerDay;