Friday, August 2, 2013

Debug any Batch job or any Posting or any service operation in AX through X++


There come a situation where you enabled all the breakpoints in your code to check the various results when executing any batch job or whenever you are doing any posting or when you are dealing with AIF services, but no breakpoint hits and the execution process is completed. The reason behind it is due to the execution of the code in CIL. So, in order to debug these scenarios need to keep the breakpoint in the .xpp file (Can be found after CIL generation in %ProgramFiles%\Microsoft Dynamics AX\60\Server\<Server Name>\bin\XppIL\Source\   Also make sure to enable the debugging on server) opened in visual studio in the expected method to hit when executing. Most of us are not comfortable to debug X++ logic in visual studio. Fortunately, we can debug the same in X++ also. Just do this small work around:
 
Open run method of the class ‘SysOperationServiceController’ and keep the breakpoint as shown below and start executing your task. When the execution pause at this breakpoint, Just drag and drop the execution into Else() code block instead of going into if () code block. (If() code block makes the code execute in XPP)

After that You can have real fun of debugging the most Critical business processes of AX :)
 


 

No comments:

Post a Comment