Microsoft Dynamics Ax, Application Integration Framework, X++ programming, AX 2009 , 2012. Enterprise portal, SharePoint , BI Tools, OLAP, OLTP, DAX, SQL Database, SSRS,SSIS,SSAS, Workflow.

Sunday, June 5, 2011

Use of Data Source Methods in axapta

Use of Data Source Methods in axapta


Adding a new record from a form will call the following sequence of data source methods:
create() ► initValue() ► refresh() ► active() ► refresh()
1. The method create() is called when pressing ctrl+n to add a new record.
2. The data source initValue() is called by create(). You should initialize fields which must have a specific value in initValue(). The table method initValue() is called by super() in the data source initValue(). If the
initialized values are not form specific, you should use the corresponding table method.
3. After initialization refresh() is called, and when entering a record active() is called. Refresh is called again by active().
When saving a record the following methods are called:
validateWrite() ► write() ► refresh()
1. ValidateWrite() will call the table method validateWrite(). Again, always
use the corresponding table methods if possible.
2. The data source method write() will call either insert() or update() from the table, depending on, whether the record is already created or not. Checks to be made should be done before this point. If you have conditions to be fulfilled these should be done at validateWrite().
3. Refresh() is called to update the form controls.
Deleting a record has a similar flow as insert and delete:
validateDelete() ► delete() ► active()
1. ValidateDelete() will call the corresponding table method. Condition checks for deletion should be done at this point, either from the data source or from the table.
2. The form data source delete() calls the table method delete().
3. Active() is called as the cursor will jump to another record after the current record is deleted.
Active Search Results Technology Blogs