How To: Use Date Effectiveness Feature in Ax 2012

  • Date effectiveness is a new feature in Dynamics AX 2012 allowing developers to easily create date range fields.
  •  Date ranges are used for defining record validity between the specified dates, for example, defining employee contract dates.
  • This feature significantly reduces the amount of time that developers spend writing code and also provides a consistent approach to implement data range fields.

Note: > We will implement date range validation on the standard E-mail templates form.
          > This Example(Data, Tables, Forms etc etc) is given on the base of Contoso Domain
          > You ll also find an Xpo File To Download at the end of the example.
          > While importing into your AOT it ll ask for replacing the existing one, you can replace it with the new table and form. 

Procedure:





  • 1. In the AOT, find the SysEmailTable table and change its property as shown below 
  • :
  •  






  • Property --> 
  • ValidTimeStateFieldType : Date

    2. Notice the two new fields that are automatically added to the table :




    3. Add the newly created ValidFrom and ValidTo fields to the existing emailIdIdx index
    and change the properties shown in the following table:


    4. The index should look similar to the following screenshot:



    5.  Next, add the ValidFrom and ValidTo fields to the table's Identification group:


    6. In the AOT, find the SysEmailTable form, refresh it using the Restore command which
    can be found in the form's right-click context menu. 

    7. Then, locate its data source named SysEmailTable and change its properties as follows:


    8. In order to test the results, Press Ctrl+ W  to open Client Work space, then  navigate to Organization administration > Setup > Open "E-mail templates" and notice the newly created fields: Effective and Expiration columns. or you can directly open the SysEmailTable form directly from AOT.

    9. Try creating records with the same E-mail ID and overlapping date ranges—you will notice how the system is proposing to maintain valid date ranges:



    Here Is The XPO of the Above ExampleDownload Xpo 

    Proud To Be a DAX Developer  :-)

    No comments:

    Post a Comment