Step-by-Step Checklist for Debugging Batch Jobs in Dynamics Ax

This post applies to Microsoft Dynamics Ax 2009 (see version note below).


A. Enable Global Breakpoints


            When debugging in the client, you want to set breakpoints that can be caught by the debugger.  The following steps show how.


1.      Launch the Microsoft Dynamics AX Configuration tool from the Start > Administrative Tools menu on your client computer. The first time this tool opens, you will be on the Original configuration. Create a new configuration named Debug. Click Manage and choose the Create Configuration menu option.


2.      Enter a new name such as Debug, and choose copy from Original configuration and click Ok.


3.      A new configuration is created and shown in the configuration tool.  Click the Developer tab.


4.      Choose the following options:

·         “Enable global breakpoints to debug code running in the Business Connector or client” (required for this scenario)

·         “Enable user breakpoints to debug code in the Business Connector” (optional for this scenario)


Note: Take special care that the Configuration Target remains set to Local Client since this is the only client you can set global breakpoints from.



B. Configure Your AOS to Run Under Your User Credentials


1.      Launch the Services utility on your AOS server machine, and choose the AOS instance that you are configuring for debugging.


2.      Right-click on your chosen AOS instance name and choose Properties. On the properties window, choose the Logon tab. Select “This account” for the Logon As option.  Enter your full Domain account {e.g. contoso\YourName } and password credentials.  This account must be the same user account as the account used for debugging batch code.


3.      Click Apply once you have modified the user account.


4.      You will be prompted to restart the service. Choose yes to restart the service (note: ensure other users are not working on this service before restarting it).



C. Configure the Dynamics AX Server to Enable Debugging


1.      From your Start > Administrative Tools menu, open the Microsoft Dynamics AX Server Configuration tool. This tool has the same option to Manage configurations that you saw earlier in the client configuration tool.


2.      Choose the Manage and Create Configuration option to create a new server configuration. As before, copy from the original configuration and choose Debug as the name.


3.      Verify the AOS instance matches the instance you want to use for debugging.


4.      Choose the following options:

·         “Enable breakpoints to debug X++ code running on this server” (required for this scenario)

·         “Enable global breakpoints to debug X++ code running in batch jobs” (required for this scenario)


Note: When you click Apply, you will be prompted to restart the service, and you should choose Yes.



D. Set breakpoints and start debugging.


1.      Launch the Dynamics AX Client from the Start menu, and open the developer workspace.


2.      Open the class you would like to debug from the AOT and set breakpoints at desired locations.


3.      Launch the Dynamics Ax Debugger from the Start menu. The debugger must be opened directly in order to find and catch global breakpoints.


4.      Schedule the batch job to run. 


Example: To schedule work calendar delete to run in batch; launch the WorkCalendarDelete class in the AOT, click Batch tab, check Batch Processing check box and click Ok.


5.      Wait for the debugger to catch the breakpoints.



E. Version information.

Batch debugging on Windows Server 2003 works with Dynamics Ax 2009.  However, a hot fix (from partners site) is needed for Windows Server 2008.  The next release of Dynamics Ax will include a fix for both operating systems (2003 and 2008).

Comments (6)

  1. Lobbi says:


    "Right-click on your chosen AOS instance name and choose Properties. On the properties window, choose the Logon tab. Select “This account” for the Logon As option.  Enter your full Domain account {e.g. contosoYourName } and password credentials.  This account must be the same user account as the account used for debugging batch code."

    As i understand this regarding step B.2, only one user can debug, am i understanding this correctly? According to this "This account must be the same user account as the account used for debugging batch code."

  2. Craig says:

    My apologies for the late response.

    Lobbi says:  "As i understand this regarding step B.2, only one user can debug?"

    For clarity, I would like to note that any number of users can debug their X++ code outside of batch jobs.  It is also possible to modify code that typically runs in batch mode and instead call it directly from a job although state could be different when code is executing on the client.  In some rare cases, debugging a batch job on the server is the only way to reproduce errors with the proper state (application data, configuration settings, etc…) and in those rare situations, then only one account can be used to debug the batch code running on the server.

  3. Rama says:


    I was in assumption that we can't debug the code running under batch process. As per my experience, i worked on so many batch job related tasks, and i solved the issues by trail and error.

    Anyways, after going through the above explanation, I came to conclusion that we can debug the batch job as well provided the AOS account logon credentials to be given as the one who is logging into the AX.

    I tried the above scenario in my local machine. But in the production environment, if two or more developers are working to solve the batch job issues, is it possible for them to debug the batch jobs?

    Right now in my machine, i am the only person who logs into the AX and i can play changing the AOS account to my credentials. Do we need to change each and every time as per the user who is going to debug the batch job?

  4. Praveen says:

    I am trying to run an import job in the background. When I run the job, there is a 'Batch processing' checkbox. If enable this option and accept the job, it is added to the user batch list with a status of 'Waiting', but is never processed.

    The following is from the documentation: 'First of all, a job can not start before an Axapta is started as a batch executer (processing).' What does this mean? Does the AOS have to be started with certain settings, or does a client have to be started with some or other settings? Can more than one job be run at once (rather than waiting for each job to finish)?


  5. Craig says:


    Yes, you will need to change credentials each time or use a specific account for running the AOS under and share the credentials accordingly.  


    Batches are only executed every minute (by default) so you may need to simply refresh the form after 5 minutes and then you will get a new status.  If not, then there might be a batch setting that is incorrect but we would need more details…  With Dynamics AX 2009 and Dynamics AX 2012, you simply need to start up the AOS in order for batch processing to be run in the background.

  6. sks says:

    This is another blog which i get very useful for dynamics learner

Skip to main content