While working on Dynamics AX forms, we come across using data source methods like Refresh, ReRead, ReSearch, and ExecuteQuery(). These methods often confuse the developer.
Following is an explanation of what their purpose is and when to use these methods:
Refresh(): Refreshes the user view with what‘s stored in the caches. This does not touch the DB.Use this after any form change has been made through code.
ReRead(): Fetches only the current record from database and does not re read the complete DataSource.Use this when you need to update only the current record after modifying any value.
ReSearch(): Will execute the same query again and fetch all the results from the database.Use this if you need to get the current most data from database.
ExecuteQuery(): Will run the query again just like research does but it will also take any query changes into account.Use this if you have modified the query on run-time and need the updated results according to the new query.
Thanks, hope it helps !!