Dynamics 365

FormDataSource display methods must be static

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.

Incorrect auto upgrade on custom methods

During our upgrade journey from AX 2012 to Microsoft Dynamics 365 Finance and Operations we have noticed some problems. The automated code upgrade tool available on LifeCycle Services for your modelstore did an incorrect auto upgrade on custom methods.

When we did the first builds, the following error message was showing up for various code pieces:

Compile Fatal Error: Table dynamics://Table/CCMTmpQuestions: [(39,5),(39,6)]: Unexpected token '/' specified outside the scope of any class or model element.

After checking the source code we have identified that somehow it has inserted extra lines at the end of some table methods, with a single / sign in them:

incorrect auto upgrade on custom methods

The quickest way to locate all those methods are to use our favorite file manager and search tool, Total Commander.

You can press <ALT>+<F7> and do a file search for *.xml in your \AOSService\PackagesLocalDirectory\[YourPackageName] folder for the following Regular expression value. You must tick the RegEx checkbox:

(^    \/)$

This has revealed all incorrect files, which we could fix in bulk. You can use similar approach as above to quickly find anything in the file-based Dynamics 365 Finance and Operations code repository.

Once you quick-replace these characters with a blank line, you are done fixing the incorrect auto upgrade on custom methods.

Go to Top