Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

How to test and investigate batch job ?

(0) ShareShare
ReportReport
Posted on by 542

Hi guys,

Need advices on how to test and investigate when something happened in batch job ?

I'm running batch job for my custom RunBaseBatch, This batch job supposedly looking at my tables, and with the test run, I have 3 records un-processed, there are flag to identify it. While all 3 records updated (means it is retrieved and processed), the subsequent process result seems to be only the 1st one.

In that class, I have error handling, but no information appears of any error, also the 1 result coming trough also not really finished, but it also no error being informed. In this subsequent process, which create record in another custom table, I also have log table when something happened, but this too not working (no records in error log). If it is not from batch process, all this error handling is working properly. FYI, this RunBaseBatch class also able to run in ad-hoc manner, so I can run manually by a button.

While this is a custom process, which of course I need to debug my self, need advice what is the best approach and what steps I should go through in order to investigate this.

Thanks,

  • Suggested answer
    Mohit Rampal Profile Picture
    12,558 Moderator on at
    RE: How to test and investigate batch job ?

    Hi Ken, We have automated entire process on click of button and faced similar issues during batch jobs. Two main issues were in which step the batch job was failed and why it failed. We created a base enum for Steps like validate, createRecord etc and in log table inserting the info message to show which error was thrown. So when executed from batch job or manually, you can check status and log table. The way we designed it was if it failed on certain step, next time when user execute the process after fixing the issue, code will be executed from that failed step only.

  • Suggested answer
    GirishS Profile Picture
    27,825 Moderator on at
    RE: How to test and investigate batch job ?

    Hi Ken,

    You can add Info log button on the required areas, and you can see the info message under System administration >> Inquiries >> Batch jobs >> Select your batch job >> Click on Batch job history button on the action pane >> On the action pane you can see the Log button >> Clicking on this button will show you the output of the info log you added.

    https://dynamics365musings.com/debug-d365-batch-jobs/

    Thanks,

    Girish S.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,095 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans