Share This Post

D365 Updates

Using The Date Effectiveness Feature In D365

Date effectiveness in Dynamics 365 allows developers to easily create date range fields. Date ranges are used to define record validity between the specified dates, for example, defining employee contract dates and defining vendor license validity.

This feature in D365 significantly reduces the amount of time that developers spend on developing business logic/code and also provides a consistent approach to implement data range fields.

This recipe will demonstrate the basics of date effectiveness. We will create a new table to implement date range validation.

Date Effectiveness:

Run Visual Studio as admin:

  1. Load your earlier project.
  2.  Add a new TablePktEmployeeContract
Date Effectiveness Feature

Date Effectiveness Feature

Set the property as follows:

   Value Property
ValidTimeStateFieldType Date

 

ValidTimeStateFieldType

ValidTimeStateFieldType

Note the two new fields that are automatically added to the table, as shown in the following screenshot (Valid To and Valid From):

Valid To and Valid From

Valid To and Valid From

3. Now create a new index as follows and add fields as follows:
4. Set the following mentioned property for the index here:

Property Value
AlternateKey Yes
ValidTimeStateKey Yes
ValidTimeStateMode No Gap

 

5. Now open the table and enter some records in this table itself instead of creating a new form for the table. Right-click on Table and select Browse table:

ValidTimeStateMode

ValidTimeStateMode

How it works…

  1. set the ValidTimeStateFieldType property to Date in the SysEmailTable table. This automatically creates two new fields–ValidForm and ValidTo that are used to define a date range.
  2. add the created fields to the primary index where the Emp1Num field is used and adjust the index’s properties
  3. set the AlternateKey property to Yes in order to ensure that this index is a part of an alternate key.
  4. set the ValidTimeStateKey property to Yes in order to specify that the index is used to determine valid date ranges.
  5. set the ValidTimeStateMode property to NoGap in order to ensure that email templates with the same identification number can be created within continuous periods. This property can also be set to Gap, allowing non contiguous date ranges.

Share This Post

Leave a Reply

avatar
  Subscribe  
Notify of
Skip to toolbar