Home > X++ stuffs > How to write UtcDateTime value along with Timezone in AX2012

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.


Welcome AX2012 🙂

Categories: X++ stuffs
  1. March 2, 2012 at 3:35 am

    Hi Santosh

    Do you have an example of a salesorder that specifies a specific deliveryaddress for a customer that has multiple delivery addresses.
    I’m unable to get the invocation correct. Ax just keeps saying that deliveryPostalAddress has invalid data.

    Thanks in advance

    • March 31, 2012 at 2:55 pm

      Hi Fernando,

      Yes i do have it. Instead i had design a small API in .NET where i transform the lower version XML (i.e AX 4) to consume in AX2012. I had to rebuild the XML for deliveryAddress stuff since it is a composite Key which is a combination of address and UtcDateTime. Please do let me know if you need it so that i can post it back.

  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: