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.