Dynamics 365 Runnable Classes (or what happened to the jobs node?)

In Dynamics AX 2012 and earlier versions, developers had access to a node under the Application Object Tree called Jobs. Jobs were blocks of executable code that ran in the client application. They were ideal for experimenting with snippets of code and performing one time updates of data after code change deployments.

In Dynamics 365, Jobs are no longer supported and they are not available in the Application Explorer. This decision makes sense as there is no longer a client application in which they would run.

Jobs node missing from Application Explorer

There is no need to panic. 😱 The truth was that Jobs were redundant and developers can accomplish the same thing with runnable classes. As a bonus, Microsoft made it as easy to create a runnable class as it was to create a job.

The steps for creating a runnable class are the same as creating any other class. In an open Dynamics 365 – Unified Operations project, open the “Add New Item” dialog. Select “Code” under “Dynamics 365 Items” in the left column. Choose “Runnable Class (Job),” give a name to the new class, and click the “Add” button.

Visual Studio will create the class and open it in the editor.

The runnable class is identical to any other class except it includes a skeleton for the static main method. When executing the class, Dynamics 365 will call this method. A developer can set the runnable class as the startup object for a project and launch it with the “Start” button from Visual Studio. This option is useful for experimenting with code or fixing data in a development or testing environment.

If the runnable class needs to run in the live environment, the developer can create an action menu item that calls the class, add it to a menu, and add security. Once the package deploys to the live environment, it will be available for the system administrator or anyone else who may have permissions.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s