≡ Menu

A few days ago, I got requirement, where I have to sum up the total quantity and amount of all Purchase line. Here we assume that All lines in Purchase order belongs to same set or convertible unit.

You can set these unit conversion settings at

Organization administration > Setup > Units > Unit conversions.




Public void SumQTYAndAmount(PurchTable  PurchTable)


PurchLine               line;



UnitOfMeasureSymbol     toSymbol ="Ranjah";

UnitOfMeasureSymbol     fromSymbol;

Qty                     SumQty=0;

AmountCur AmountPurch=0;

UnitOfMeasureRecId      fromRecid,toRecid;





select * from plan where plan.PurchTable == PurchTable.PurchId;


//  select sum(LineAmount), sum(QtyOrdered) from line where line.PurchId == PurchTable.PurchId;

while  select * from LineQty where LineQty.PurchId == PurchTable.PurchId


if ( LineQty.PurchUnit ==toSymbol)


SumQty +=LineQty.QtyOrdered;





fromSymbol = LineQty.PurchUnit;

toRecid =UnitOfMeasure::findBySymbol(toSymbol).RecId;

fromRecid =UnitOfMeasure::findBySymbol(fromSymbol).RecId;

landQty += UnitOfMeasureConverter::convert(landQty,fromRecid,toRecid,NoYes::Yes);







Dynamic Ax provide the option to create purchase order against one-time vendor or supplier. It means one-time vendors can transact only once.

If you create a new purchase order, you find this option at the top of vendor creation form.


There is possibility that we can create multiple one time vendors or supplier against normal supplier. For that we can select vendor in Invoice account.







Dynamics Ax provide a separate sequence number for one-time vendor / supplier. You can set this sequence number form Account payable parameter form.



Small tip today, In one of my custom SSRS report for Dynamics Ax 2012 on group total, requires conditioning,
For example sum did not include the value in the based on certain value of other field.

I used following expression to solve this problem.
=Sum(iif(Fields!FieldName.Value <> “abcdxyz”, Fields!FieldName.Value, CDbl(0)))
I took help from following link:



Git with Dynamics ax 2012


Recently I explored GIT as source control tool. As per work with Microsoft Technologies I worked with TFS and Source save.  In Dynamics Ax 2012 context I found AX2GIT on codeplex and





I download ax2git zip. After extraction I found  XPO.



So I decided first to download its perquisites. i.e. Git and tortoise for Git. I used following links

Git from   http://msysgit.github.io/


Tortoise Git from http://tortoisegit.org/


After Installing tortoise and Git, windows right click popup menu shows me  git and tortoise options as follow




To check git works, I create a new folder and create Git Repository there by windows right click popup menu.


Following popup appeared


After click on ok, I found following pop up to show success message




Now I opened Dynamics ax and import the ax2GIt.xpo




Import it, it overwrite some Ax artifacts.  When Xpo successfully imported, right click on any node in AOT => add-ins have Git menu.







Currently Ax2Git support only export.

I opened one of my existing project and export it GIT options. Right click on project node when project open with all its detail. And click on add-ins=>Git=> Export AOT selection.



And click on Export AOT selection

welcome to the world of git


As I am working Dynamics Ax 2012 CU8 demo vm so current layer option will.  Other as per documentation, it will create separate branch for each layer.

Export to folder process starts


And I target folder I found folders in all files are exported properly.

It will creat



Selected all folder and commit the changes.







All files are successfully committed.


For testing it reflect changes, I open Ax form and add following empty comment in one of the form



On again export project from AX. Repository folder it shows some changes are not commit.

Reflect changes

On checking the right click to see the diff
reflect 2-001

Yellow highlighted items line it shows the difference, what previously checked in new exported code




Today I got requirement to insert record at run time and shows result in sorted order. I used following code code snippets. Suppose we are sorting on Customer
in required field


CusTable_ds.query().dataSourceNo(1).addSortField(fieldNum(CustTable, AccountNum), SortOrder::Ascending);


I got error  “‘FormRun’ could not be created “on EP. When I test the submit for approval in EP.

I have to reimplement all methods with respect to following link





During development suddenly Ax stop working. When I try to connect web url https://usnconeboxax1aos.cloud.onebox.dynamics.com. It shows page can not display. Previously it was working fine.

On Event viewer I found following exception.


The description for Event ID 110 from source Microsoft Dynamics AX cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.


If the event originated on another computer, the display information had to be saved with the event.


The following information was included with the event:


AX is shutting down due to an error.

Duplicate metadata element has been detected in multiple modules. Please verify that application is deployed correctly and installed modules are compatible. Following elements are defined in more than one module:

Element AxService/tstColorService is defined in the following modules: ServiceTest, ApplicationSuite


Solution: During development I created artifacts with same name in different models on different occasions. Surprisingly no warning or error appears during development about object of same name already exists in AOT. I open required solution rename artifacts and build solution. AX web application start working again.


Usually I forget this step during code migration from environment to other. So I note it down for future reference.

The best way to move labels from environment to copy the *.lac file form location

C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\Application\Appl\Standard

And paste on some common folder in target environment.

And then import it by right click on aot => labels =right click and create from file.

new enviroment


Hi, All I found new Dynamics AX RTW download link on Microsoft connect.  Microsoft update that link at 24/2/2016. After download you have to follow following two links to configure it on your machine.


Access Microsoft Dynamics AX Instances

Running Dynamics Ax 7 CT8 Vm on Windows 8.1



End user in Pakistan industry love the Excel. I worked in local Pepsi franchise for two years. Everything they need raw data or reporting data into excel. They called it cycle. Because their office work cycle starts and end on excel. How much complex report you developed for them, if it not converted into excel it is useless (I was working in Oracle 6i reports at that time). So recently I decided to explore excel power query that helps to extract complex data from AX to excel. Later user can easily convert or format according to his / her needs. So here are some my key notes to connectivity with Excel power Query.

Currently for this article I used demo data and Microsoft demo vm AX R3 cu9.

For Excel power Query you have to download add in from following link. It works fine for excel 2013.



When you open the above link in browser following screen will open

Download Link

Click on download button. Following screen will open


As per my machine has 64 bit version of excel so I download 64 bit version of it.


After download run it setup.


Click on next


Click on next



Finally click on finished button.


Now open Excel and you find following new tab will be added on tab strip.


If you did not find this tab in excel. Check the excel option and enable power query add-in. You can possibly found it at this location.


Now its time to connect excel with Ax. For this you have to verify that you AIF services are successfully configured and deployed on AX. If not then generate incremental CIL to verify that no error in your environment and AIF services are successfully working.

Now open Ax client and go in organization administrator module. You can follow menu link as

Organization administrator =>Setup=> Document management=> Document data source


On click on it you found following form.


As I am going to test on out of the box Query so I decided to use “USSalesUSMF2011”. You want to use your own query then select it in above screen and also activate it.


Now switch back to excel and from Power Query tab select  “From Other Sources” => “From OData Feed”


From new screen select following Ax Query service with default url


Query address will be vary if you are using excel add in on client and AOS on some other location.


Click on Ok. From next screen click on windows screen. As I am trying to connect on demo machine with default admin user so I select my current credentials. Otherwise you have to create a user in AX and he has to write Access on ODataQueryService and all tables in side Query to fetch data.



Click on next  you find navigator from


Select required query. And click on ok.

You find data against query in Excel as following



Now if you expert in excel, you can make magic from here.