Showing posts with label FormDataSource. Show all posts
Showing posts with label FormDataSource. Show all posts

Form Data Source Field Method Override D365FO


Form Data Source Field Method Override D365FO



In this demo, I will show to create an extension class of form data source Field class and override method through COC.

Here is the annotation code to create COC



[ExtensionOf(formDataFieldStr(FormName, DataSourceName,DataFieldName))]


In this demo, we are using the HcmWorker form and creating Extension of DirPerson Data source field Personal Title..

[ExtensionOf(formDataFieldStr(HcmWorker, DirPerson,PersonalTitle))]

In actual code, you can find the method in the Hcmworker form 


 [DataField]
        class PersonalTitle
        {
            public Common lookupReference(FormReferenceControl _formReferenceControl)
            {
                return DirUtility::buildAffixReferenceControlLookup(_formReferenceControl, DirNameAffixType::PersonalPrefix);
            }

        }


Here is the code through which we create extensions.

[ExtensionOf(formDataFieldStr(HcmWorker, DirPerson,PersonalTitle))]
final class Demo_Extension
{
}


Here is the code through this we override the method.


[ExtensionOf(formDataFieldStr(HcmWorker, DirPerson,PersonalTitle))]
final class Demo_Extension
{
    public Common lookupReference(FormReferenceControl _formReferenceControl)
    {
        next lookupReference(_formReferenceControl);
        return DirUtility::buildAffixReferenceControlLookup(_formReferenceControl, DirNameAffixType::PersonalPrefix);
    }

}

Now perform build in sync on your module. enjoy


Support Faryal's Cusine


Record sorting D365FO, AX 7 and AX-2012


Record sorting D365FO, AX 7 and AX-2012


Today, I got requirement to perform sorting on form with table data source while inserting records..



SLDOffsetTaxDS_DS.query().dataSourceName(formDataSourceStr(SLDOffsetTax,SLDOffsetTaxDS)).addSortField(fieldNum(SLDOffsetTax, Priority), SortOrder::Ascending);

SLDOffsetTaxDS_DS.query().dataSourceName(formDataSourceStr(SLDOffsetTax,SLDOffsetTaxDS)).addSortField(fieldNum(SLDOffsetTax, CountryRegionId), SortOrder::Ascending);

Support Faryal's Cusine


Virtual Fields Vs Computed Fields

  Virtual Field: A virtual field in D365FO is a field that doesn't have a direct representation in the database. It's a field that y...