Dynamics AX Blog - sysoperation-framework

These posts are machine-translated.
Currently, only posts are displayed, which contain the tag »sysoperation-framework« Filter entfernen

SysOperation-Framework: Controlling ExecutionMode and server method to be executed using the MenuItem

If you want to control the SysOperationExecutionMode and/or the server method to be executed via the MenuItem in a SysOperation construct, you can control this via the properties of the MenuItem.

Scenario: Without own controller

The following two MenuItems show how to set the properties for them:

This MenuItem calls the runService() method of a service class and sets the SysOperationExecutionMode to Synchronous:

Screenshot


 
 
 

SysOperation-Framework: Force Batch Processing

If you want to make sure that a function implemented via the SysOperation-framework is always executed via batch processing, you can set the SysOperationExecutionMode to ScheduledBatch (e.g. via the MenuItem of the controller - see here).

If this is a function that requires a user dialog, however, the problem is that the "Batch" tab is displayed by default and, for example, the "Batch" check box is not activated there.

Of course you can activate this checkbox by including a call to parmBatchExecute() in the UIBuilder:

public void build()
{
    super();

    this.controller().batchInfo().parmBatchExecute(this.controller().parmExecutionMode() == SysOperationExecutionMode::ScheduledBatch);
}

 
 
 

SysOperation-Framework: Usage data per MenuItem

Imagine you have a function build using the SysOperation framework that can be called at different places in the system, and you want to make sure that these calls do not share the same usage data.

In such a case you could create two (or more) MenuItems and override the method lastValueDesignName() of the controller as follows. This will store separate usage data for each MenuItem.

protected IdentifierName lastValueDesignName()
{
    IdentifierName ret;

    ret = super();

    if (this.parmArgs() && this.parmArgs().menuItemName())
    {
        ret = this.parmArgs().menuItemName();   
    }

    return ret;
}

 
 
 

Create batch job with multiple tasks by code

The code snippets below show how to create batch jobs using the BatchHeader class.

Examples for a RunBaseBatch construct

static void createBatchWithMultipletasks(Args _args)
{
    BatchHeader batchHeader;
    Tutorial_RunbaseBatch batchTask1, batchTask2, batchTask3;

    //create batch header
    batchHeader = BatchHeader::construct();
    batchHeader.parmCaption("Example of a batch job with multiple tasks");

    //create instances of the classes to use as batch tasks
    batchTask1 = Tutorial_RunbaseBatch::construct();
    batchTask2 = Tutorial_RunbaseBatch::construct();
    batchTask3 = Tutorial_RunbaseBatch::construct();

    //add the batch tasks to the batch header
    batchHeader.addTask(batchTask1);
    batchHeader.addTask(batchTask2);
    batchHeader.addTask(batchTask3);

    //save the batch
    batchHeader.save();
}

 
 
 

SysOperation-Framework: Simplest class construct

The code below is the simplest way to implement a function using the SysOperation framework. Without DataController, Dataprovider and UIBuilder. Only with a service class and a MenuItem.

Service

class TutorialSysOperationSimpleService extends SysOperationServiceBase
{
}

The runService() method is the actual service method. The SysEntryPointAttribute attribute controls that no further authorization checks are necessary.

[SysEntryPointAttribute(false)]
public void runService()
{
    info("Done");
}

 
 
 

SysOperation-Framework: Enable batch processing by default

If you want to activate batch processing by default for a function implemented via the SysOperation framework, you can do this by modifying the UI Builder like in the following example.

public void build()
{
    super();
    
    this.controller().batchInfo().parmBatchExecute(NoYes::Yes);
}

The code activates the checkbox Batch processing in the Batch tab.

Screenshot


 
 
 

SysOperation framework: Pass selected records from a temporary table

In the following scenario, all records of a temporary table are to be passed to a SysOperation construct.

For that we need:

  • In the DataContract, a accessor method (parm-method) that takes a container
  • In the controller, a logic that iterates the records of a calling data source and packs it into a container, and passes it to the service using the above method
  • In the service class we need code, which unpacks and processed the transferred container

 

Controller

class TutorialSysOperationController extends SysOperationServiceController
{
}

 
 
Pages 1 2 3 » 

 

 
 
 
Posts of the actual month
März 2024
MoTuWeThFrSaSu
 123
45678910
11121314151617
18192021222324
25262728293031
 
© 2006-2024 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.