web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Change batch job status to error based on Batch error log

(0) ShareShare
ReportReport
Posted on by 2,585 Super User 2026 Season 1

Hi All,

We have a scenario where we need to parse through all the batch job history details and set the status of the batch job to error, set the status of the batch job to error, if the batch log has errors in it. As per standard Ax or Operations, the batch job task, if marked as ended, sets the entire batch to Ended. Instead, if the all the batch job tasks are marked as Ended, and if there is an error in the log, the entire batch should be set to Error status, instead of Ended. 

I was successful in fetching the error details of the batch job from the log, but what's the best practice to set the batch job status to error, if there are error logs in the batch tasks log or the batch log?

I have used the SysInfologEnumerotor, to fetch the details of the batch log, but while setting the batch job status to error, the AOS crashes. The approach that I have used is fetch the error log and based on the error log, update the status in the BatchJob table to Error. Later, I have added this method as an event handler in the BatchJob table's update() method, as a post event handler. Is this the right approach? Please correct me, if I am wrong. 

For example, let's say I have created a movement journal TEST_001 and added it to the batch queue. The movement journal processes successfully with all the lines successfully processed, but if there are errors in the log, then the whole batch status for the movement journal should be set to Error.

Thanks in advance.

Regards,

Navneeth.

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    239,253 Most Valuable Professional on at

    What's the point of handing all errors, let everything to get into Ended state instead of Error and then digging into infolog and trying to reimplement what the framework would do for you?

    Why don't you simply throw an exception from the failing tasks and let AX to handle the rest for you? That's the best practice.

  • Navneeth Nagrajan Profile Picture
    2,585 Super User 2026 Season 1 on at

    Hi Martin,

    Thanks for the suggestion.

    All the exceptions are caught for the failing tasks. As per standard Ax functionality, if any of the tasks is set to Ended and if the infolog for that task has an error, then the entire batch is set to Ended. The requirement is if the infolog for that task or for any of the tasks has an error, the batch status should be set to Error, instead of Ended. The batch, as per standard Ax, is set to Ended which is not what's required, in this case.

    Regards,

    Navneeth.

  • Martin Dráb Profile Picture
    239,253 Most Valuable Professional on at

    Yes, I understand it and I believe that "All the exceptions are caught for the failing tasks" is the bug. If you don't swallow all exceptions, the task will fail and therefore the whole batch. That's how it normally works, but your handling of all exceptions breaks it. Throw an exception if a task fails.

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    You typically store in the global variable scope or in the task management thread if there were any errors during execution if they are handled in a try-catch block for sub-tasks.

    All you need to do is to check if the global variable is set to true (in case an error has occurred), then throw the error as Operation has failed or similar in the controller thread.

    Alternative solution is to set a dependent batch task which can be triggered in case one of the tasks had an error, and do a throw there.

  • Community Member Profile Picture
    on at

    Hi Navneeth,

    How did you come across this issue..?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 26

#2
imran ul haq Profile Picture

imran ul haq 8

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 4 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans