Blog

31 03, 2022

FormDataSource display methods must be static

By |2022-03-31T15:15:58+02:00March 31st, 2022|Categories: Dynamics 365 for Finance and Operations, MSDyn365FO|Tags: , , , |0 Comments

During our Dynamics 365 code upgrade the display methods on forms were raising an error. The new rule is that FormDataSource display methods must be static calls. Here is the relevant section from the Docs site:

https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/extensibility/customize-model-elements-extensions#experiment-with-table-extension-display-and-edit-methods

Our change to display an Employee’s custom Job title looked like this after the upgrade:

[ExtensionOf(formDataSourceStr(HcmWorker, JJEAdditionalEmplTable))]
public final class HCMWorker_DS_JJEAdditionalEmplTable_JADOperation_Extension
{
    static display Description jobTitleDescription(JJEAdditionalEmplTable _additionalEmplTable)
    {
        Description ret = '';
        if (_additionalEmplTable)
        {
            ret = JJEJobTitles::find(_additionalEmplTable.JobTitle).Description;
        }
        
        return ret;
    }
}

In the form designer now you need to refer this display method as a static call as per below in your extension:

HCMWorker_DS_JJEAdditionalEmplTable_JADOperation_Extension::jobTitleDescription
FormDataSource display methods must be static

This should eliminate the error messages for your custom display methods.

31 03, 2022

Force executing batch jobs

By |2022-03-31T13:16:31+02:00March 31st, 2022|Categories: AX 2012, Microsoft Dynamics AX|Tags: , , , |0 Comments

There is an old, but good article posted by Tariq Bell about the inner workings of the AX Batch framework. When you are working with Dev and Test instances and enable/disable the Batch flag in Server configuration, it might take a while before your tasks are starting to run. There is a simple trick to force executing batch jobs.

As explained in the reference article, each batch task and the framework itself triggers this call, when they are ready to finish execution and a new task needs to be picked up. You could just write a simple job and trigger it with a Menu Item on Server side to kick off a batch job earlier.

static void Job1(Args _args)
{
    BatchRun::serverGetNextTask('01@YOURSERVERNAME');
}

Providing the correct instance number and the server name is required in order to force executing batch jobs.

We have used this method in part to change the batch framework itself, and allow execution of jobs faster than the typical 1 minute schedule. I wanted to post about those findings, but unfortunately that code is not compatible with more recent versions of AX 2012 R3 CU10+, due to Microsoft introducing the new SP_GETAPPLOCK calls in the framework.

Go to Top