giovedì 10 agosto 2023

How to extend the Dialog class in D365 FFO

How to extend the standard class DIALOG in order to use in different points the custom methods(like lookup, validation etc).
It can be useful to use methods and standardize the code.

class MyCustomDialog extends Dialog

  public void my_lookupCustom(FormControl _callingControl )
  {
  // some code
  }
  boolean my_validateCustom(FormControl _callingControl)
  {
    // some code
  }
  boolean my_CustomGenericMethod(FormControl _callingControl)
  {
     // some code
  }
}

How to use the custom methods:

MyCustomDialog dialog; // use my custom class

dialog = new MyCustomDialog("TEXT");
dialog.addText("Some text");
dialog.my_CustomGenericMethod(....) ; 

Another way to use the custom methods:

// other example
 fieldSite.registerOverrideMethod(methodStr(FormStringControl, validate),
                                  methodStr(MyCustomDialog , my_validateCustom), dialog); 

Below how appear:




We can create different methods to meet our needs.

enjoy