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

SysOperation Framework: Simple class construct with data provider

The code below is a simple class construct for the SysOperation framework.

Datacontract

[DataContractAttribute]
public class TutorialSysOperationDataContract
{
    CustAccount custAccount;
}

 

[DataMemberAttribute]
public CustAccount parmCustAccount(CustAccount _custAccount = custAccount)
{
    custAccount = _custAccount;
    return custAccount;
}

 

Service

class TutorialSysOperationService extends SysOperationServiceBase
{
}

The method runService() is the actual service method. Using the SysEntryPointAttribute attribute, we control here that no further authorization checks are necessary.

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

 

Controller

class TutorialSysOperationController extends SysOperationServiceController
{
}

In new() we link the controller to the service class.

void new()
{
    super();

    this.parmClassName(classStr(TutorialSysOperationService));
    this.parmMethodName(methodStr(TutorialSysOperationService, runService));
}

The main() is the classic entry point when the controller is called via a MenuItem.
In the example, we fill the DataContract with a fixed value at this point. Here, for example, you would use the args object to determine the caller and fill the DataContract accordingly.

public static void main(Args _args)
{
    TutorialSysOperationController controller;
    TutorialSysOperationDataContract dataContract;

    controller = new TutorialSysOperationController();
    controller.parmArgs(_args);

    controller.parmExecutionMode(SysOperationExecutionMode::Synchronous);

    // DataContract
    dataContract = controller.getDataContractObject();
    if(dataContract is TutorialSysOperationDataContract)
    {
        dataContract.parmCustAccount("10001");    
    }
    
    controller.startOperation();
}
These post applies to following version:
Dynamics AX 2012

Andrei 08/15/2022 14:21 | #1

its worked?

Add comment
 
 

 

 
 
 
Posts of the actual month
September 2022
MoTuWeThFrSaSu
 1234
567891011
12131415161718
19202122232425
2627282930 
 
© 2006-2022 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.