Set "never" in datetime.

I’m writing an import script to import employees into AX 2012. I’m encountering a problem with the employment “validto” in the HCMEmployment table. I want to set this as “never”, as a large amount of the test data is. I can set this through the table by opening the calender and clicking “never” however I was wondering how I could do this through X++ code.


Not sure how you are writing this script.

But when I use AIF script for importing employees, some how AIF sets ‘never’ value to ‘validTo’ field.

When I get a chance, will post the AIF script for creating workers.

I was just writing an X++ script to import from a csv file.

Actually it doesn’t matter. “Never” just selects the latest possible data from the AX calender. I’ve just set the dates to some ridiculous time in the year 2120 and it has much the same effect. The only difference is that the database doesn’t say “never”.


Not sure whether you are aware. You can use ‘DateTimeUtil::maxValue()’ for such purpose.