16 January 2015

How does date effective CreateNewTimePeriod work

Two different descriptions of CreateNewTimePeriod update mode lead me to the question - how does it actually work?

Description 1 (msdn)
When you change a field value from a valid time state table, the current record in the table is closed and a new record is created. The current date, or current date and time, populate the ValidTo field of the closed record and the ValidFrom field of the new record.

Description 2 (Inside Microsoft Dynamics AX 2012)
The date-effective framework creates a new record with updated values, and updates the ValidTo of the edited record to a value of ValidFrom -1 of the newly inserted record.

Problem description
What sequence of methods is used in CreateNewTimePeriod update mode?

Steps
1. Open DirPartyTable form
2. Add a new address
3. Modify the address

Hints
Add infolog messages to insert and update methods of LogisticsPostalAddress table.


Solution
LogisticsPostalAddress is date effective table and CreateNewTimePeriod mode is used in LogisitcsPostalAddress form.
To clarify the sequence of methods let's add infolog messages to insert and update methods before and after super().

The sequence of methods appeared to be:
Methods sequence of date effective CreateNewTimePeriod mode

It means that new period is inserted before edited record is updated.

If you still have doubts add LogisticsPostalAddress to database log (see details in previous post) and add breakpoints to \Classes\Application\logInsert and \Classes\Application\logUpdate methods.

No comments:

Post a Comment