Resolving Visual studio tools 2013 installation error in AX 2012 R3 CU8

When trying to install visual studio tools the following error occurs “This installation package could not be opened. Verify that the package exists and that you can access it” This is mostly caused by VS tools folder missing inside the msi folder of your installation setup. If these folders are there then you might have a different issue. To resolve this for R3 builds follow the following blog by Microsoft support:

After this simply run your installer again and add the visual studio component, worked like a charm for me!


Time taken: 40mins


Transfer Demo data into AX 2012 R3

For transferring demo data into R3 versions of AX 2012 follow the below:


1 Get Demo data package and extract it into any feasible  location (Extraction will be large about 15-20GB)


Takes 20mins
2 Get Data transfer tool to transfer package extracted data in AX DB <<>>

3 Import MetaDataXMLGenerator.xpo into AX environment and run the job


Take 30mins

This will be found in the Data transfer tools folder you extracted above
4 Copy Metadata file generated as output of the above job to the [Lists] folder in the Data Transfer tool directory File is mostly generated at the following path





5 STOP AOS before moving to the next step  
6 Open command prompt as admin. Go to directory where Test import tool was extracted.

Run the following command


Takes hours (2-3 approx.)


DP.exe IMPORT “C:\Users\mohsin.khalid\Downloads\MicrosoftDynamicsAXR3CU8DemoData” MicrosoftDynamicsAx



FYI; In above command “MicrosoftDynamicsAx” is your ax db name




  Total time of activity 4 hours approx

Debugging without a startup project or startup Object in D365

To debug without setting up a startup project and startup object in D365 fotr operations. Follow these steps:

  1. Open your object in visual studio
  2. Place breakpoints
  3. Goto Debug>attach to process and check show processes from all users
  4. Select w3wp.exe and click attach.


You can execute your process now from the client and execution will be stopped at your breakpoints.


Breakpoint symbols not loading AX7/D365

Recently faced a problem where my breakpoints weren’t loading for objects in the AOT that were not in my solution and therefore I could not debug.

Solution: In order to load symbols for objects that have not been included in your solution you have to uncheck the following check box.

Dynamincs365>Options>Dynamics 365>Debugging
Load symbols only for items in the solution


To know more about how to debug in D365 visit: Debug X++

How to Recall/Cancel a workflow through code in AX 2012

To recall a workflow through code you can use the cancelworkflow method in workflow class. It takes the correlationId and a comment as parameters and gets the job done for you. Example

workflow::cancelworkflow(CorrelationId, “Cancelling this workflow”)

Now you are probably thinking How do I find my workflows CorrelationId. You can do that by querying WorkflowTrackingStatusTable sorting it with time and instance number and joining it with SysWorkflowtable against the correlationId field and in the contextId you pass the RecId of your record for example PO RecId.

Fix for Error: Field ‘Company’ and ‘Lot ID’ must be filled in”

When editing a PO line for procurement category you receive Field ‘Company’ and ‘Lot ID’ must be filled in” error. This usually happens when you have brought in the PO line through some form of integration either AIF, excel plugin etc.

This error has also been seen on salesLine and there is a hotfix(KB 2756645) for when it happens on salesline.



There is no record in PurchLineForeignTradeCategory table related to PO line added.



Create a record against the PO line causing this error in the PurchLineFroeignTradeCategory table in your integration and you will see the error disappear.

Difference between Refresh(), Reread(), Research() and ExecuteQuery() in AX 2012

In X++ we have the below methods for fetching data after any changes are made, below is the short description of what they are and when to use each one.

Refresh() refreshes the user view with whats 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 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 is you have modified the query on run-time and need the updated results according to the new query.