Monday, November 12, 2018

Difference between Init and InitValue Method in AX

We don't have init method on Table level, we have InitValue method in Table.

initValue :


  • Executed when a new record is added.
  • initValue is automatically called from forms.



We have both init and initValue at form datasource level

init

  • The form is opened.
  • Creates a data source query based on the data source properties.

initValue

  • A new record is created. The purpose is to fill in initial values in the record.
  • Initializes field values in a new record.

If you use this method to specify field values, the new values are not automatically saved to the database when you leave the form. To specify values that you want to save when you leave the form, use the Create method.


We have only init method in Form Level :

init:
  • The form is opened.
  • Use the method to initialize a form. The init method is started immediately after the new method and creates the run-time image of the form.

Typical uses of init include the following:

  • Modifying a form by using the FormBuild system class
  • Initializing variables for specific controls on the form.
  • You must call the super method if you override this method, and you should add your code before the super call.

In addition to creating the form, the call to the super method constructs the data source for the form by starting the init method on the data source. The form data source init method creates the query to fetch data from the database and sets up links if the form is linked to another form.

No comments:

Post a Comment

How to enable the dimension fields based on the Item selected on the form.

[Form] public class KMTShipFromWarehouses extends FormRun {     InventDimCtrl_Frm_EditDimensions        inventDimFormSetup;     /// &l...