“AX client execution of ‘Executing CIL generation’ timed out” TFS build

I was setting up a new build definition for my project and was facing the exception of Time out error “AX client execution of ‘Executing CIL generation’ timed out”

Initially I assumed that there should be some issue in Ax CIL and tried few troubleshooting steps
1.Increased the execution time of CIL in build from 60 minutes to 180 minutes.
2.Launching manual full CIL from my login . It completed without any errors.
Then I tried logging on to build account credentials . When Ax is launched , customer experience dialog pop up displayed. So I understood this window was blocking the CIL step.
Clicked ok and took a back up of the database (Reason being this latest database has the option of not displaying additional dialogs from this login). Then used this database as staging database.
Amazing.. It worked. 🙂
In order to avoid any additional dialogs to be displayed when Ax launched, set the field “SQLEnabled” from SysUserInfo table .



Posted in Ax 2012, TFS build | Tagged , | Leave a comment

Trace Parser – Ax2012

If you find any performance issues in the code or if Ax moves to not- responding mode in mid of executing a process, developer can take the help of readily available tool in Ax – Trace Parser.
User can analyse the events which causes performance bottlenecks (X++ code taking longer time to execute, indefinite while loops etc) .
I am not explaining the steps in trace parser installation in this post. Our focus will be on its usage and how it helps developer when there is a performance hit.
How to reach this tool in Ax?
By default, the parameters , “Xpp” and “BindingParameters” are disabled. You need to enable it.
Click “Start Trace” and specify a file name. . Execute the scenario which gives performance issue . Once done, “Stop Trace” and this will create a trace file .
Now click “Open Trace” button. In case you get any error in opening the file,
go to start and type Trace parser
You can import the trace file . Attach your session to investigate the scenario.
Call Tree tab shows the hierarchy of events happened.  Long duration tasks are highlighted in red which helps the developer to analyse the code.
X++/RPC tab – You can sort it by exclusive and inclusive and find the calls taking most of the time.  There is a call stack tab which shows the trace of the methods called.
SQL tab : It shows the db calls and it helps the developer to check the DB statements which consumes more time . It can give us the clue if any index is missing or an insert during the index causes the problem.
With this, we get basic idea on using Trace parser. I am briefing you about another tool from SQL side which is called “Activity monitor”.
This tool ,when used with Trace parser helps to fix the performance issue in the application. You should have administrator permission to trigger this tool.
Option 1
Option 2 : Shortcut icon

The column “Head Blocker” specifies if there is any process blocked during execution .We will also get to know the dependant process is affected by this block.

In order to kill the blocking process, right click and select the option “Kill”.
To dig more the details, click “Details” tab which gives a hint on the statements that are causing the block.


So  Activity monitor and Trace parser go hand in hand to pull out the performance issue without investing more time in probing the issue.
Posted in Ax 2012, Performance, Tracing | Tagged , , | Leave a comment

Update physical dimension of an item Ax2012 – CSV import

There are two ways where we can update the physical dimensions of an item in Ax2012.
Option 1:
Option 2:
Option 1 updates the fields in invent table . But it doesn`t reflect the changes in option 2 form (Manage Inventory -> Physical dimensions).
If either width or depth or height is changed , Volume calculation has to be done manually.
So this option is not the ideal way to update the physical dimensions fields.
Option2 addresses all the issues in former approach. Changes done on this table would reflect in Invent table fields . Volume calculations are taken care as well.
Thus , apt way to modify the values of physical dimensions will be from the path PIM-> Released Products -> Manage Inventory -> Physical dimensions.
Code snippet is given below to import the fields using csv.
static void AE_ImportItemsPhysicalDimensions(Args _args)
Dialog dialog = new Dialog();
DialogField dialogField;
AsciiIo importFile;
str filePath,fileNameOnly;
filetype type;
container record;
str Delimiter = “,”;
int totalRecords, updates;

InventTable inventTable;

dialogField=dialog.addField(extendedTypeStr(FilenameOpen),”Select File”,”Select file to import”);
dialog.caption(“Import Items weight and size”);
[filePath, fileNameOnly, type] = fileNameSplit(dialogField.value());
importFile = new AsciiIo(dialogField.value(), ‘R’);
if((!importFile) || (importFile.status() != IO_Status::Ok))
warning(“Error in opening import file”);
if((!importFile) || (importFile.status() != IO_Status::Ok))
warning(“Error in opening log file”);
while(importFile.status() == IO_Status::Ok)
record = importFile.read();

inventTable = InventTable::find(conPeek(record,1), true);
select forupdate Width, Height, Depth from WHSPhysDimUOM where WHSPhysDimUOM.ItemId == inventTable.ItemId && WHSPhysDimUOM.UOM == ‘Un’;
warning(strFmt(“Item %1 doesn’t exist.”,conPeek(record,1)));
WHSPhysDimUOM.Width = conPeek(record,3);
WHSPhysDimUOM.Height = conPeek(record,4);
WHSPhysDimUOM.Depth = conPeek(record,5);
info(strFmt(“Total updated items = %1 out of %2”,updates,totalRecords));

Posted in Ax 2012, Dynamics Ax, File Handling, Uncategorized | Tagged , | Leave a comment

Count of records in a query

Here is a simple command which can be executed even in a job to take a count of records for a query.


Posted in Ax 2012, Uncategorized | Tagged | Leave a comment

Request for the permission of type “FileIO Permission” failed

Users would face this error though they had defined code level permission to access the file path.
In order to test if the logic is correct, we try the code snippet for the path check in a job and we get the expected result. So there is nothing wrong in our code but may be the approach has to be tuned.
How do we solve this? Check :
  1. What is the approach used for path exists check ? – Is it WinAPI or SystemIO ?
  2. If the logic is using WINAPI, check the framework in Ax classes .
  3. SysOperation framework supports WinAPI but not RunBase.
    Thus if you are using RunBase in your class, try using System.IO approach
         Example : System.IO.Directory::Exists
Posted in Ax 2012, File Handling | Tagged | Leave a comment

Model management in Dynamics 365 operations

In this post, we will see basic model management functions : – Export / Delete / Import
Before diving into these, i will brief you on what model is ? Model is a group of elements (metadata/source code/ .Net assemblies  ) that constitutes distributable software solution.  The model file can be installed / exported to/from another environment .
To perform these operations, use ModelUtil.exe which will be located in %/AOSService/PackagesLocalDirectory\Bin
Export Model file :
ModelUtil.exeexportmetadatastorepath=[path of the metadata store] –modelname=[name of the model to export] –outputpath=[path of the folder where the model file should be saved]
On executing this command, model will be exported to the specified path.
Delete the model:
ModelUtil.exe -delete -metadatastorepath=[path of the metadata store] –modelname=[name of the model to delete]
Import the model:
ModelUtil.exe -import -metadatastorepath=[path of the metadata store where model should be imported] –file=[full path of the file to import]
If the expected parameter missing , system specifies the same in the error message.
In the below command, I used the parameter “filename” instead of “file” when importing the model. So the system warns the user about the missing parameter.
Posted in Dynamics 365 Operations - Ax 7.0 | Tagged , | Leave a comment

Event Handling – Dynamics 356 operations

There are situations where certain logic needs to be applied prior to or after execution of the few methods. Event handlers can be used for such cases.
In Dynamics 365 operation, we can trigger event handlers for the fields in form datasources or tables.
In this post , I have explained using Form Eventhandlers.
Let us see how an event is triggered when a field is modified in the form.
Navigate to the field in the datasource and select ” OnModified” event.
Right click on the event and choose “Copy Event Handler  method”.
Add a new class from the solution explorer and paste the contents inside the braces of class declaration.
To make it simple, we shall print an info that the field has been modified.
Final step is to build the solution, and run the form.
When the field is modified, an infolog pops up below the action pane.



Posted in Dynamics 365 Operations - Ax 7.0, Event Handling | Tagged | Leave a comment