Skip to main content

Posts

Showing posts with the label AX Tables

PostLoad() method in AX tables

Today I found an interesting thing with regards to AX tables and this post is all about this new experience which is the PostLoad() method in AX tables. When we create a new table in AOT, Morphx automatically creates a series of methods for it. We cannot see those methods but those can be overriden on each table as per requirements. PostLoad() is one of these system methods. List of all system methods can be seen from here  https://msdn.microsoft.com/en-us/library/aa625830.aspx Lets create a new table, I named it PostLoadTable with two fields Name and Value. I added 5 records in the table manually (open table and added). Tables in Microsoft Dynamics AX have a number of system-defined methods, such as insert, validateField,validateWrite. For a list of these methods, see the xRecord system class. The xRecord class can be seen as the base class for the Common table. The Common table can be seen as the base t...

Stop deletion of record from a table

Recently came across an issue where records from customized tables were being deleted occasionally. Following wat did a quick fix for me to stop further records delete from table.  Overwrite delete method on table and comment super(). This also stops deletion from code, e.g. if we write query delete_from table this commented super will prevent user to delete record from table. public void delete() {     //super(); } This will also stop deletion from code too. e.g. It worked fine but records can also be deleted by pressing Ctrl+F9 on table browser. To handle this situation I overwrite validateDelete method on table and returned False from there. public boolean validateDelete() {     boolean ret;     ret = super ();     return false ; }

AX 2012: Forms and Tables methods call sequence

Many a times we came across the point that where should we write code either it would be in init() of a form or in datasource init() method. And which method will be called first and where you can actually retireve record and what would be best way to accomplish few basic requirements without impacting the performance. For all above reasons I found an interesting link and thought it would be worth sharing here. http://www.slideshare.net/HamdaouiAmine/microsoft-dynamics-ax2012-forms-and-tables-methods-call-sequences-30159669#