How To Use D365 Batch Jobs

Share this:

In this article learn to how use D365 batch jobs to automate and offload recurring tasks to the server. This will allow your employees to be more productive and save time. Learn to recognize when a process can be run as a batch job. And learn about the many processes that can be run by the server.

Over the course of this article I will explain how to setup and use D365 batch jobs using the user interface. If instead you are interesting in developing a custom batch job of your own, please take a look at two of my other articles. Create A D365 Batch Job. Or, SysOperation Framework In D365.

In subsequent articles I will explain how to manage and monitor batch jobs.

Why Use A D365 Batch Job?

D365 Batch jobs allow users to run a process in the background. Most of often they are used to run processes that can take a long time to run. Or need to run on a scheduled re-occurrence. For example, a batch job can be run once a day during the night time. This way the process will not take processing power away from the users during the day.

However, even processes that just need to be run one time can be offloaded to the server, as a batch job. Even if the process a user is running will only take a minute to run, why wait for the process to finish if you do not have to? The system can be directed to run the process in the background, while the user continues to work. This creates a more enjoyable user experience.

Additionally, when a process runs as a batch job, the code will continue to run, even if the user closes their browser.

While some tasks require a process to finish before continuing on to the next steps, other processes do not. Users just care that they are run, but do not need to wait. Or perhaps they are the last step of a larger task.

To help understand, let us look at an example.

Example

For example, many D365 systems use the Invoice batch job to invoice sales orders. This is the last step a sales order needs to take. As part of this process, the system does many things including updating the financials. Therefore, it can take some time to run for each sales order.

Sometimes a user might want to print the sales order invoice report and view it. However, often times the invoice report gets emailed to the customer, and there is no need for the user to see it. In this case, users care that the process finishes successfully. But, they do not need to wait for it complete before moving on to other tasks.

This is where offloading work to batch jobs allows a user to be more productive. Let’s look at how this would be done. Both as a batch job running on a recurrence. As well as a one time process that runs on the server, instead of in the users browser.

Run Process In Browser

In D365, go to Accounts receivable > Orders > All sales orders.

Next, select one or more sales orders with the status ‘Open order’, that also have the same customer account. Then, in the ribbon bar, go to the Invoice’ tab > Generate > Invoice button.

In the dialog that opens, make sure that the ‘Quantity’ field under the ‘Parameters’ fast tab is set to ‘All’. Otherwise, the system might not find any sales lines that can be invoiced.

Additionally, users can optionally click the ‘Select’ button. This will show the query being used, and allow the user to filter the sales orders and lines being show.

In this example, the query is limited to this particular sales order. When setting up a batch with a recurrence, the filter criteria should be more open. Such as sales orders with a status of ‘open order’ or later.

Click ‘Ok’ to close the ‘Select’ dialog.

Lastly, click the ‘Ok’ button on the ‘Posting invoice’ form to invoice the sales order in the browser.

Notice, the process may take a number of seconds to finish. In contrast, let us look at how we would use D365 batch jobs to run this process.

Run Process In Batch

Instead of always waiting on a process to finish before moving onto the next step we can use D365 batch jobs to offload the work to the server.

To demonstrate, let’s look at the same example. Follow all of the same steps and shown above. First, select sales orders. Then select Invoice > Generate > Invoice button.

Validate the parameters, selection query, and that there are sales lines to be invoiced.

Finally, instead of clicking the ‘Ok’ button, click the ‘Batch’ button.

In this case, the system will open the standard ‘Batch processing’ dialog form. There are many components on this form that will show on every batch job in D365. For the moment, I will focus on what is most important.
Make sure the ‘Batch processing’ radio button is set to ‘Yes’. This tells the system to run the process in the background on the server. And NOT hold up the user’s browser until it is finished. Finally, click the ‘Ok’ button.

Alerts and Recurrence

Often times a user might also want to setup the batch job to run on a recurrence. Or setup an alert to inform them if the batch job experiences an error. Thankfully, this is functionality that comes with all batch jobs. I will be covering this in the next article on managing batch jobs.

Processes That Can Be Run In Batch

Obviously, not every process is setup to run as a batch job out of the box. So keep an eye out for the ‘Batch’ button. Or menu items that show a dialog box with the ‘Batch processing’ radio button. These are good indications the process can use D365 batch jobs.

Unfortunately, I have not been able to find Microsoft documentation that lists all of the batch jobs in Microsoft Dynamics 365 for Finance and Operations. However, I did find this great article by Kurt Hatlevik who listed out more than 87 batch jobs that exist. He also categorized them by functionality. Additionally, he provided the menu items and descriptions.

All in all, it would be wise for all users to check these lists to see if any of their daily processes could be changed to use D365 batch jobs.

Lastly, if you are running other common lengthy processes that do not already have the ability to run as batch jobs, consider writing custom code to allow them to run as batch jobs. See these two articles. Create A D365 Batch Job. Or, SysOperation Framework In D365.

Conclusion

In this article, you learned how to use D365 batch jobs to offload otherwise time consuming processes to the server. Allowing the D365 users to be more productive and accomplish more in the same amount of time. You learned how to recognize a batch job. Additionally, you learned that even tasks that you only need to run once can be run as batch jobs.

There is still a whole lot more to cover around batch jobs. In the next article I will explain how to manage the batch jobs you have setup.

Peter Ramer
Peter Ramer is a part of the Managed Application Services team at RSM working on Microsoft Dynamics 365. He focuses on the Retail and Commerce industries. When he is not solving problems and finding ways to accelerate his clients' business, he enjoys time with his three kids and amazing wife.

Share this:

6 thoughts on “How To Use D365 Batch Jobs

Add yours

  1. How can i Programmatically change the task description for this batch job?
    For example , i want to change the “order invoice ” to “order invoice batch job ” using x++ . how can i deal with this?
    I tried it with controller class but did’t find any method

  2. Hello Peter,
    Thanks for your blogs
    I have a question, is there one of your articles or any source information about how to apply some control (approval) over the batch?

    1. Hi. Thanks for your question.
      In D365 you can use security roles so that only authorized people can run these batch jobs.
      You can run the batch job just once. Or you can setup the job to run a recurrence.
      Beyond that I am not exactly sure what approval you are looking for.
      You could have the batch job only process records in a particular status. And make it so someone changes the status when the record is approved. I hope that helps some.

Leave a Reply

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

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑