RunBase framework in D365 F&O

Rumman Ansari   Software Engineer   2023-04-30   844 Share
☰ Table of Contents

Table of Content:


RunBase framework

Sure, here are the key points to understand the RunBase framework in D365 F&O:

  1. Legacy Batch Processing Framework: The RunBase framework is a legacy batch processing framework that has been used in earlier versions of Dynamics AX and is still being used in some scenarios in D365 F&O.

  2. Class Hierarchy: The RunBase framework relies on a class hierarchy that includes the RunBaseBatch, RunBase, and RunBaseReport classes. Developers can create custom classes that inherit from these classes to define batch processing jobs that require user input.

  3. User Interface: The RunBase framework provides a basic user interface for defining batch jobs, with options for specifying input and output parameters, as well as scheduling and running the job. However, this user interface is limited compared to the modern user interface provided by the SysOperation framework.

  4. Object-Oriented Limitations: One of the drawbacks of the RunBase framework is that it is not fully object-oriented, which can make it less extensible and harder to customize. It also requires the use of several classes to define input and output parameters, which can be cumbersome.

  5. Being Phased Out: While the RunBase framework is still used in some scenarios in D365 F&O, it is being phased out in favor of the more modern and extensible SysOperation framework.

How to develop RunBase framework in D365 F&O

Here are the key steps to develop a RunBase framework in D365 F&O:

  1. Define the Input and Output Parameters: Define the input and output parameters for your batch job. These can be defined as public or protected member variables in your custom class.

  2. Implement the Run Method: Implement the Run method in your custom class to define the logic for your batch job. The Run method should be the entry point for your batch job and should call any additional methods required to perform the job.

  3. Implement the Dialog Method: Implement the Dialog method in your custom class to define the user interface for your batch job. This method should display any required input parameters to the user and allow them to specify the values.

  4. Implement the Pack and Unpack Methods: Implement the Pack and Unpack methods in your custom class to serialize and deserialize the input and output parameters for your batch job. These methods are called automatically by the system when the job is executed.

  5. Create a Batch Class: Create a batch class that instantiates your custom class and calls the RunBase::runBase method to execute the batch job. The batch class should also define any required batch attributes, such as the batch group and maximum batch size.

  6. Register the Batch Class: Register your batch class in the Batch Job List form in D365 F&O. This will allow users to select and schedule your batch job from the user interface.

By following these steps, you can create a custom batch job using the RunBase framework in D365 F&O. However, it is worth noting that the RunBase framework is a legacy batch processing framework and is being phased out in favor of the more modern and extensible SysOperation framework.

coding example RunBase framework in D365 F&O

Here is an example code for a custom batch job using the RunBase framework in D365 F&O:


class MyCustomBatchJob extends RunBaseBatch
{
    public container pack()
    {
        // Serialize input parameters
        return [#MyInputParameter];
    }

    public void unpack(container packedObject)
    {
        // Deserialize input parameters
        [#MyInputParameter] = packedObject;
    }

    public boolean validate()
    {
        // Validate input parameters
        return true;
    }

    public void run()
    {
        // Execute batch job logic
        // ...
    }

    public Dialog dialog()
    {
        DialogRunbase dialog = super();
        // Define dialog fields for input parameters
        // ...
        return dialog;
    }
}

class MyCustomBatchJob_Batch extends RunBaseBatch
{
    public void main(args args)
    {
        MyCustomBatchJob batchJob = new MyCustomBatchJob();
        batchJob.runBase();
    }
}

In this example, MyCustomBatchJob is the custom batch job class that extends the RunBaseBatch class. The pack and unpack methods are used to serialize and deserialize the input parameters for the batch job, while the validate method is used to validate the input parameters before executing the job.

The run method is where the actual logic for the batch job is implemented, while the dialog method is used to define the user interface for specifying the input parameters.

The MyCustomBatchJob_Batch class is the batch class that instantiates the MyCustomBatchJob class and calls the runBase method to execute the batch job.

Note that this is just a simple example, and a real-world batch job may require additional logic and error handling.