How to write UtcDateTime value along with Timezone in AX2012
In AX2O12, we can manage record relationship that are valid for a specific date range, by setting the ValidTimeStateFieldType property to UtcdateTime.
Let’s draw a scenario where you need to parse an XML which was built on lower version (S.O) and push data into AX2012 system using AIF. In scenario as above, we might end-up having relation w.r.t LogisticsPostalAddress which has ValidFrom as an attribute and the framework XMLWriter would validate the data only if the parsed UtcDateTime is correct as shown format.
The sample code shown below will explain how the dateTime is parsed an converted into UtcDateTime format which could be accepted by the AIF when they are surrogate Key relationship on ‘ValidFrom’ on the master table.
The below image displays the virtual table which was created at run-time to show the ValidFrom entry made against the user timezone.
Based on the created record the dateTime is converted into UtcDateTime and displayed to the users.
Example illustrated above is attached in the following link, named as SharedProject_Conversion_DateTimeToTimeZone.