This post is machine-translated. The original post in german language can be found here.
These post applies to following version:
Dynamics AX 2012
Dynamics AX 2012
|
|
|
|
|
|
|
This post is machine-translated. The original post in german language can be found here.
These post applies to following version:
Dynamics AX 2012
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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:
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
Servicegroup AxClient
Call
Calling the function can be done via a MenuItem for the controller class or by using following code: