D365 F&O — BatchRetryable Batch Job

Ben
2 min readMay 10, 2021

Automatic retry settings for batch jobs has been fully released for D365 F&O with version 10.0.18 which went General Availability as of April 16 2021.

With this feature there is a new interface called BatchRetryable. This interface is quite simplistic but basically allows you to implement a new method called IsRetryable. This method will be called when the batch system encounters a transient error. This method simply returns true or false to determine if the job should retry.

The Setup

I have a Controller, Contract, Dispatcher setup. The BatchRetryable is attached to the Controller class.

When I tried attaching it to the Dispatcher class, where I actually have logic to be performed, it didn’t seem to pick up on the BatchRetryable. But it does work on the Controller level.

Next I simply return true in the IsRetryable method required for the BatchRetryable with a bit of logging to the warning section just in case.

Replicating Transient Errors in Development

My first question wasn’t really if this works but how I can test it out. Since our development environment is a self contained VM we don’t really get these errors in development. To replicate those errors I decided on throwing the transient exception randomly at the start of my batch job.

This caused me an infinite loop issue. To resolve this I stored the retries in a table and when it was over 2 I stopped throwing the error message.

Conclusion

This seems to work quite well for the time being. I haven’t been able to move this to production but I hope to update this article with the results once I am able to update our environments and move this code along.

--

--

Ben
Ben

Written by Ben

Senior Software Engineer. Programming Fan.

No responses yet