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.

Go to Top