This post is machine-translated. The original post in german language can be found here.

SysOperation-Framework: Asynchronous processing

The SysOperation framework can also be used to execute functions asynchronously. For this, the ExecutionMode is set to SysOperationExecutionMode::Asynchronous.

This makes sense, for example, when a time-intensive action is to be started, but the user does not have to wait for the end of this action and has to be able to continue working on other topics.

However, such asynchronous processing only works if the following criteria are met:

  • The function was integrated as a service
  • This service has been added to the AxClient service group
  • The user has activated the Run Business Operations into CIL option

Here is a simple example of such a construct:

 

Service-Class

class Tutorial_AsyncService extends SysOperationServiceBase
{
}

 

[SysEntryPointAttribute(true)]
public void runService()
{
    // Do your work...this simple example only sleeps for 10 seconds
    sleep(10000);
    
    info("Finished");
}

 

Controller-Class

public class Tutorial_AsyncController extends SysOperationServiceController
{
}

 

public static void main(Args _args)
{
    Tutorial_AsyncController controller;

    controller = new Tutorial_AsyncController(
        classStr(Tutorial_AsyncService),
        methodStr(Tutorial_AsyncService, runService),
        SysOperationExecutionMode::Asynchronous
        );

    controller.run();
}

 

Service

Service 

 

Servicegroup AxClient

AxClient 

 

Call

Calling the function can be done via a MenuItem for the controller class or by using following code:

Tutorial_AsyncController::main()
These post applies to following version:
Dynamics AX 2012

Add comment
 
 

 

 
 
 
Posts of the actual month
April 2024
MoTuWeThFrSaSu
1234567
891011121314
15161718192021
22232425262728
2930 
 
© 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.