Thursday, October 29, 2015

AX 2012 :See the SQL query that the Dynamics AX Kernel is generating on Form

See the SQL query that the Dynamics AX Kernel is generating on Form

When you are debugging your solution you sometimes might want to see the SQL Query the Dynamics AX Kernel has generated for your Form.
While you can of course trace this directly at your Database Server, you also can do this in X++ using the QueryBuildDataSource class.

Let's imagine you have a Form that has PurchTable as Data Source.
You have to override the executeQuery method of the PurchTable Data Source and add the following code:
public void executeQuery()
{
   Query q;
   QueryBuildDataSource qbds;
   ;
   q = this.query();
   qbds = q.dataSourceName("PurchTable"); //Replace with the current Table
   info( qbds.toString() );

   super();
}

No comments:

Post a Comment

Table browser URL in D365FO

Critical Thinking icon icon by Icons8