General X++ Development

How do I debug a batch job in D365FO?

Asked by Sunny Vasty· Aug 13, 2026· 1 answers

How do I debug a batch job in D365FO?

SSunny Vasty75 reputation · answered Aug 13, 2026

In a development environment, put the breakpoint in the batch/service code first, then make sure the batch task actually runs on the development machine you are debugging.

For classic DevTest/VHD environments, you may need to attach Visual Studio to the batch service process. If the batch service is not available to attach to, restart it and make sure the job is assigned to a batch group that runs on that machine.

For newer unified development environments, use the supported Dynamics 365 debugger workflow for that environment.

For async-only issues, I also add temporary targeted logging around the values I actually care about:

  • Company
  • Batch task / execution path
  • Record IDs
  • Parameters
  • The branch of logic that ran

Do not log the entire world. Log enough to prove what happened.