When you are working for a longer period with Microsoft Dynamics 365 and namely when you have experience with older versions, you will take things for granted. Microsoft Dynamics 365 is changing, and it is hard to stay updated of all changes. In this post, I will elaborate on some changes on the batch jobs in Microsoft Dynamics 365 for Finance and Operations. The new features will help you managing the batch jobs in your own environment. Apart from these new features, be aware of unexpected caveats. Life’s a batch…

Switch to enhanced form

For quite a while we are used to a legacy form where batch jobs and the tasks are two separate forms. There is now a new button available to switch to a new user experience for batch jobs.

Life's a batch

When you click the option Switch to enhanced form, the design will be different. The list looks a bit different. The common menu items for opening e.g. the history, change status and recurrence are now direct visible on the form and the grid has been reorganized.

Life's a batch

The job ID itself is an integer value and the primary key of the batch job records. This field contains a direct link to all the batch job details and tasks as you can see in the next screenshot.

Life's a batch

You may have your own opinion, but I do prefer the new enhanced form. I do expect that this enhanced view will become the standard in the future.

Disable or delete users

Every user can create batch tasks for e.g. periodic tasks or reports. It would be interesting to know what happens when you inactivate a user or even delete the user. What is the impact on the batch tasks? This section contains the background and a wake-up call to choose the right user for creating batch jobs. A small change compared to Dynamics AX 2012 and previous versions is also mentioned which has a relation with the heading of this paragraph.

When you disable a user, the batch job will initially not change. You will get a warning when there are active batch jobs created by the user.

Life's a batch

When the batch framework is trying to execute the batch job on the scheduled moment, it will check the status of the user as present in the field Run by. When the user is inactive, the batch job will be set to canceled. There is one exception here. Now new in Dynamics 365 is the possibility to change the field Run by of the batch job. When executing the job, it will look at the status of the user which will be used to run the batch. However, the error message as shown above is checking the created by field of the batch job. So, you can still get a warning if the Run by field is already set to another user.

Before looking at what happens when we delete a user, I have removed all permissions from a user. Only the system user role was still assigned. The user itself was enabled and still a batch job configured. The batch job contained a ledger transaction report which would be stored in the print archive. In this case, you don’t get any warning in upfront. The result in my case was that the batch got into a freeze on the Executing status. I tried to change the status to Canceling, but it was also stuck on that status. Only a restart of the services fixed this issue.

Until now, we could solve all issues with batch jobs to be reset or changed to run by another user account. But the next scenario is scary. What happens when you delete a user? Before deleting the user, let’s have a look which batch jobs are active. Alicia has two batch jobs with a job description starting with Consistency.

Life's a batch

Now, we can delete the user ALICIA from the environment. You will get a question to confirm your action.

When you click Yes, the user will be deleted from your environment. Now check what happened with her batch jobs.

When we now search for the consistency batch jobs or search on the user name, we can’t find the batch jobs anymore. They are deleted from the environment. I one way, I can understand that non executable batch jobs will be deleted. However, there was no warning that these batch jobs would be deleted. You can argue if this is a desired behavior or not. In my opinion not having a warning and just deleting the batch jobs is not desirable. Imagine, a user created all batch jobs for retail integrations. The user leaves the company. A system administrator deletes the user and after three days the whole company is in doubt why the retail statements are not posted. Then someone takes a look at the batch jobs and find out that they are DELETED.

Of course, it is best practice to setup all business-critical batch jobs to be run by a system account which will never be deleted. However, in most cases a key user or external consultant is setting up some batches during go live or shortly thereafter. Due to high pressure these people know that they should login temporary as another user, but just wants to quickly solve go-live issues. Then they forget about changing it… Do you recognize this scenario?

Another reason why I don’t like to have the batch jobs deleted is that it is cascading the delete with a link on the field Created by. When you had created the batch jobs and had a clear idea to change the Run as field, you thought you did a good job. Unfortunately, regardless the contents of the field Run as, the batch jobs are deleted. More about this situation later in this post…

Copy batch job

Another new feature in Dynamics 365 is the option to copy a batch job. With this option, you can save your company from disasters when you found out that some critical batch jobs are running with a wrong user account. In this way, you don’t have to recreate the batch job from scratch. It will copy the parameters, settings and recurrence from the original one. The process is quite easy. Click the Copy batch job button and complete the fields in the slider dialog. Then click the OK button.

Life's a batch

As a result, you will have a second batch with the same parameters, but the Run by field as specified in the dialog. Copying the batch jobs needs to be done one by one. A multi select for using the Copy batch job functionality is not supported.

There is one downside related to this copy function. As I did copy the batch with my own user account, the Created by field is now having my user ID. If you want to know the impact, you have to reread the section Disable or delete users. So, to prevent to have the batch job accidentally deleted, it would be recommended to use this feature with the system service account used for critical batch jobs.

Active periods for batch jobs

Another welcome feature is a definition for active periods. You can make a distinction between business hours and off-business hours or e.g. afternoon. Using these active periods you can manage to have some batch jobs running in business hours every minute, but not after business hours. Then you can free up resources for heavy daily tasks.

Life's a batch

Did you notice the cool time-lookup? You can open this by clicking on the clock icon in the field. When you have your active periods defined, you can setup the required active period on batch jobs.

The active periods is a great addition to this batch framework. However, there is something missing here. When you create a new batch task from a periodic option or a report, there is no option to specify the active period directly. You have to specify it afterwards by navigating to the Batch job form.

Dynamics 365 application ideas

As a summary, there are the next new features available for the batch framework in Dynamics 365 for Finance and Operations:

  • Enhanced form
  • Copy batch job
  • Change run by
  • Active periods

In this post, we discussed that deleting a user can have impact on the organization which needs some better alerting. Also, there might be an option to be able to directly assign an active period when creating batch jobs from periodic tasks and reports. I have created two ideas on the Dynamics 365 Experience Ideas site. You may want to vote for them to get it prioritized by Microsoft:

  1. Warning about existing batch jobs when deleting a user.
  2. Have the option to specify an active period when creating a batch job from a periodic task or report to be run in the background.

My last comment in this post: Don’t forget about using a service account for setting up your critical batch jobs!

I do hope you liked this post and will add value for you in your daily work as a professional. If you have related questions or feedback, don’t hesitate to use the Comment feature below.

That’s all for now. Till next time!

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.