Dynamics 365 Finance and Operations: Debugging Batch Processes Gone Mad

by | Updated September 14, 2018 | Development, Dynamics 365 for Finance and Operations, Dynamics AX

One of the more interesting aspects of our job as developers in Dynamics AX/Dynamics 365 for Finance and Operations can be getting enough information to reproduce an issue.  This can be especially true if there are multiple processes running via batch, that may affect the data in ‘unexpected’ manners.

Say for instance a user reports an issue with some data.  When manually iterating through the process, it works wonderfully, and all results are expected.  You go through and attempt to blatantly break the system, and the checks seem to function as designed.  You sit and scratch your head, and mumbling under your breath.  You go back to the user and ask them how they got the data into this state.  They THEN come back to you and state that they didn’t, the system did.  You do some examination, and lo and behold, there is a batch process that runs in the background that automates the process you just manually attempted to break.

So, being the good developer you are, you start debugging that process, and it seems to function as expected as well.  Back to digging.  You then find ANOTHER batch process that runs that may also affect the data.  But, how do you tie everything together and prove that this is the cause?

When I see this, one of the things I like to do is create custom logs for the processes.  You can write your hooks into the code and provide a ton of useful information.  I like to do something similar to the warehouse work creation log history functionality where I provide a form to the end user that has the process information (using descriptive labels of course – this is where the strFmt() function can really be your friend).  I like to also put the call stack into the information, and allow the user to add that to the form via a personalization if desired (and possibly add it to a ‘General’ tab on my history form).  The call stack can be added into the data via code similar to this:

/how-to-send-the-callstack-to-the-infolog/

I also add a time stamp to the data, as we will be using this in the next step.

I also provide methods of disabling the logging, and options for clearing the data, as this can become data intensive rather quickly.

Once this is done for all the suspected processes, the fun begins.  Once the issue appears again, you can write X++ jobs or TSQL statements to analyze the data from the different log tables (compare time stamps is usually a good place to start) to see if it can be determined what is going on (specific code running in a certain order, changing data at unexpected times, data rollbacks due to failure, etc.).  Dumping the data to Excel can be an option as well if you are an Excel wizard (I am not, so I tend to shy away from that).

Trace parser might be able to help you here as well, but I have actually found that some clients like having the log functionality for other uses as well.  It may be enabled periodically and used to see if some processes are taking a while, are being called rather frequently, or possibly being scheduled to run too frequently for the amount of work that is being processed.

So, in summary, I guess I am trying to say that sometimes thinking a bit out of the box may be beneficial in ways we as developers may not initially intend.  Use established processes, but if there is a way to provide more information with little or no penalty to performance, go for it.

If you have any questions or if debugging batch processes have you going mad, feel free to contact us here at Stoneridge Software.

Related Posts

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Upcoming Events

september

01sep10:00 am10:30 amEnsuring Quality and Compliance for Batch Manufacturers in Life Sciences

01sep12:00 pm12:30 pmIs it Worth It to Move to the Cloud? A Look at Considerations for Current Agribusinesses Using Dynamics GP

01sep2:00 pm2:45 pmWhat’s New in Dynamics 365 Finance and Supply Chain

09sep11:00 am12:00 pmConfab Live with Stoneridge – Data Strategy and Reporting – Mining Decision Making Insights

15sep10:00 am11:00 amSolving the Biggest Challenges in Agribusiness Through Innovation and Technology

22sep12:00 am12:30 pmSimplifying Payroll and HR Management with ADP Workforce Now

22sep10:00 am10:30 amStreamlining Batch Manufacturing with Technology

22sep2:00 pm2:30 pmProcess Automation for Microsoft Dynamics D365 for Business Central, Finance and Operations and GP

23sep11:00 am12:00 pmConfab LIVE with Stoneridge - Riding the Wave 2 Release – Key Features Coming to Dynamics 365 this October

29sep10:00 am11:00 amTop Five Reasons Why NOW is the Right Time to Move from Salesforce to Dynamics 365 Customer Engagement

29sep12:00 pm12:45 pmUnderstanding Job Costing and Tax Management in Business Central

29sep2:00 pm3:00 pmDigitalizing Horticulture & Agriculture - How to Sell Plants Online and Simplify Business Management

30sep12:00 pm4:00 pmSecurity and Permissions Training for D365 Business Central or Dynamics NAV

october

06oct10:00 am10:30 amPreview of D365 Business Central Fall Release Features and Functionality

06oct12:00 pm12:30 pmInsider's Guide to New Features Available in the Fall Release of D365 Finance and Supply Chain

07oct11:00 am12:00 pmConfab LIVE with Stoneridge - Dataverse and Dynamics in Review – Let’s Get Technical

21oct11:00 am12:00 pmConfab LIVE with Stoneridge - Dataverse and Dynamics in Review – Let’s Get Functional

26oct(oct 26)9:00 am28(oct 28)5:00 pmStoneridge Connect Leadership and Community Conference

About Stoneridge
Stoneridge Software is a unique Microsoft Gold Partner, with emphasis on partner. With specialties in Microsoft Dynamics 365, Microsoft Dynamics AX, Microsoft Dynamics NAV, Microsoft Dynamics GP and Microsoft Dynamics CRM, we focus on attracting the most knowledgeable experts in the field to our team, and prioritize delivering stellar solutions with maximum impact for your business. At Stoneridge, we are deeply committed to your results. Each engagement is met with a dedicated team, ready to provide thorough, tailored, and expert service. Based in Minnesota, we intentionally “step into your shoes,” wherever you are. We focus on what you care about, and develop trusting, long-term relationships with our clients.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!

X