Wednesday, December 7, 2016

A dynamic query range for month to date (SysQueryRangeUtil)

Here is the code for creating a month-to-date filter:

public static str monthToDateRange(int relativeDays = 0)
    utcdatetime currentDateTime;

    currentDateTime = DateTimeUtil::applyTimeZoneOffset(DateTimeUtil::getSystemDateTime(), 

        DateTimeUtil::date(DateTimeUtil::addDays(currentDateTime, relativeDays)));

The code must be added to the SysQueryRangeUtil class.

Use it like (monthToDate(n)) where n is the number of days from today. So month-to-date-yesterday would for example be (monthToDate(-1)).

Thursday, December 1, 2016

First place to look when batch seems not be working i AX7

When you can see that the batch service is not really picking up any jobs, the first place to look is normally in the batch group setup. Here you'll validate that the different batch groups are connected to a batch server.

And here comes the fun part where AX7 might trick you, if you not on your toes. The selection panels for Selected and Remaining servers have switched places since AX 2012...

Here is the dialog in AX 2012:

And here it is in AX7:

A thank you goes out to Lau Larsen for pointing this out.