Pages

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::getUserPreferredTimeZone());

    SysQueryRangeUtil::dateRange(
        dateStartMth(DateTimeUtil::date(currentDateTime)),
        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.

Friday, November 25, 2016

Monthly curated list of AX development news from the community - 2016 11

Here is the shortlist of what I think is the most important developer community news from this month. And yeah, the month isn't over, but it's a Friday thing for me.

This is a list I try to keep as short as possible, making it manageable for most people to look through the articles on the list. If your article is not on the list, I may have overlooked it (hope not) or it fell for the prioritization of making this list short. I have a lot more ongoing links on my Twitter profile and my Flipboard magazine.

Thursday, November 24, 2016

Difference between "Local" and "Remote" settings in the "Run mode" property of a form part

Recently I was wondering what the difference between the "Local" and "Remote" settings in the "Run mode" property of a form part actually meant. I couldn't find any documentation on the wiki.

In a Microsoft Yammer community Harold Albrich of terna GmbH pointed me to an earlier answer in the same forum. Since this blog also serves as my own notebook, I'll share my version of the answer here:

When the form part is called as Remote, there is no coupling between the form part and the caller form. So no linking of data sources and also no element.caller() object. And as Remote the form part is executed in a separate session.

With Local it is the other way around. You can link data sources and you can work with element.caller().

Tuesday, October 25, 2016

SQL Server trial license expired on your cloud boxes for AX7?

If you have made deployments before summer, you might have deployments where the SQL Server is installed with a trial license and it is set to expire november 1st. When it expires you are not able to start the SQL Server service anymore.

Here are the necessary steps to update SQL Server:

  • Obtain a valid installation media and license. 
  • Stop the "Hyper-V Time Synchronization Service" service.
  • Change the system date on the server, to a date before the trial expiry date.
  • Run SQL Server installation and choose "Upgrade from preview version"
  • Start the "Hyper-V Time Synchronization Service" service again.

The reason for changing the system date is that the upgrade won't run if it can't start the existing SQL Server service.