23 Mar 2013

RunBase framework

The RunBaseBatch class extends the RunBase class and allows one to create classes (jobs) that can be added to the batch queue. Once the job has been added to the queue, it will be executed by the batch server. This concept is known as batch processing.
Whenever you write a class that typically asks a user for input and then starts a process based on that input you use the RunBase framework as most of the typical methods needed for such a Job is already implemented in the RunBase class. This means that using the RunBase framework is done by extending RunBase either by directly extending RunBase or by extending a class that extends RunBase.

Some of the features implemented in the RunBase framework are the following:
• Run: The main flow of the operation
• Dialog: Prompting the user for input and storing that input
• Batch execution: Schedule the Job for later execution
• Query: Used to select data
• Progress bar: Shows the progress of a task
• Pack/unpack with versioning: Remember variable values until the next time
the task is executed
             
Pack and Unpack method:

This method is a standard method inherited from RunBase. It is used to save
the values that the user selects and store them until the next time the user executes
the class.

public container pack()
{
    ;
    return [#CurrentVersion,#CurrentList];// + [super()];
}

public boolean unpack(container packedClass)
{
    container       _base;
    boolean         _ret;
    Integer         _version    = conpeek(packedClass,1);
    switch (_version)
    {
        case #CurrentVersion:
            [_version, #CurrentList, _base] = packedClass;
            //_ret = super(_base);
            break;
        default:
            _ret = false;
    }
    return _ret;
}

And your class declaration looks like:

class ItemCreationApprove extends runbase
{
    Dialogfield fieldapprover;
    approvedby  approver;
    #define.CurrentVersion(2)
    #localmacro.CurrentList
        approver
    #endmacro
}

Other framework in Microsoft dynamics AX:

 Runbase Framework
 Batch Framework
 Dialog Framework
 Operation Progress Framework
 NumberSequence Framework
 SysLastValue Framework
 AIF-Application Integration Framework
 Wizard Framework
 Infolog Framework
 Unit Test Framework

No comments:

Create number sequence in D365 FO

Create the data type. Add code in the loadModule method of the appropriate NumberSeqModule subclass. Add a method to the module’s paramet...