Showing posts with label Form Data Source Method override COC D365FO. Show all posts
Showing posts with label Form Data Source Method override COC D365FO. Show all posts

Form Data Source Method override COC D365FO


Form Data Source Method override COC D365FO


Here is the sample how can you override the form data-source event.

In this demo we have created the extension of HcmWorker form data-source (HcmWorker).


Here is the original method  of HcmWorker data-source 

    public boolean validateWrite()
        {
            boolean ret;

            ret = super();

            if (ret)
            {
                partyForm.validateWrite();
            }

            return ret;
        }

Here is the  code to create form data-source extension class 

[ExtensionOf(formdatasourcestr(HcmWorker, HcmWorker))]
final class Demo_Extension
{

}


Here is the code to override the data-source method through COC.

[ExtensionOf(formdatasourcestr(HcmWorker, HcmWorker))]
final class Demo_Extension
{
    public boolean validateWrite()
    {
        boolean ret;

        ret  =  next validateWrite();

        if (ret)
        {
                    
           /// do your code here
        }

        return ret;
    }

}


In last perform Build & Sync.

Important 
Feature available from Build 8.1 PU-20


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...