Microsoft Dynamics Ax Table Method
Methods are used for adding X++ code to your application. The code in methods is also referred to as business logic. Whenever records are changed, inserted or deleted from a table various default methods are executed. We can change the default methods and by doing so we are overriding the default methods. To override a method go to the Methods node of a table, right click and choose Override Method. Below are few examples of Overriding commonly used Table methods: initValue(): If we create a new record from the table browser or a form the table method initValue() is executed. It is used to set a default value for the fields. Example (1): Let’s override intiValue for MyFirstTable and set default value for custGroupId public void initValue() { super(); this.custGroupId = "10"; } After adding this method, open table MyFirstTable through Table browser and press ctrl+n to create a new record. The field custGroupId will now have the default value 10. modifiedField(...