Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

How to pass parameter value from controller class to service class in sysoperation framwork batch processing

Posted on by 735

Dear Experts,

I am facing issue to pass parameter value from controller class to service class (ProcessOperation Method) using sysoperation framwork and not in ssrs report class, The requirement is to process some data using batch job (Reliable Asynchronous) and no client side dialog box required to put parameter value so I have set showdialog property to false in the class, now I am unable to pass some parameter value from my form using controller class to service class operation method. Pls guide me if I am missing something

Controller Class 

public class SysOperationControllerClass1 extends SysOperationServiceController
{
}

public void new()
{
this.parmShowDialog(false);
super();

this.parmClassName(classStr(SysOperationServiceClass1));
this.parmMethodName(methodStr(SysOperationServiceClass1, processOperation));

this.parmLoadFromSysLastValue(false);
this.parmDialogCaption("Batch Operation Dialog Title - BKS");
}

public static void main(Args args)
{
SysOperationControllerClass1 controller;
controller = new SysOperationControllerClass1();

controller.parmShowDialog(true);
controller.startOperation();

}

//Contract Class

[DataContractAttribute]
public class SysOperationDataContractClass
{
TransDate dateValue;
}

[DataMemberAttribute,
SysOperationLabelAttribute('Date Property'),
SysOperationHelpTextAttribute('Enter a date in past'),
SysOperationDisplayOrderAttribute('1')]
public TransDate parmDate(TransDate _dateValue = dateValue)
{
dateValue = _dateValue;
return dateValue;
}

//Service ClASS code

public class SysOperationServiceClass1 extends SysOperationServiceBase
{
}

public void processOperation(SysOperationDataContractClass _contract)
{
info ("Running SysOperation Batch Operation");

info ("Date Property: " + date2Str
(_contract.parmDate(),
213,
DateDay::Digits2,
DateSeparator::Dot,
DateMonth::Long,
DateSeparator::Dot,
DateYear::Digits4));

}

 

 

 

  • Verified answer
    B K Sharma Profile Picture
    B K Sharma 735 on at
    RE: How to pass parameter value from controller class to service class in sysoperation framwork batch processing

    Hey ievgen,

    Thanks Its working

    SysOperationControllerClass1 controller;

       SysOperationDataContractClass contract;

       controller = new SysOperationControllerClass1();

       controller.parmLoadFromSysLastValue(false);

       controller.parmExecutionMode(SysOperationExecutionMode::Synchronous);

       contract = controller.getDataContractObject('_contract');

  • B K Sharma Profile Picture
    B K Sharma 735 on at
    RE: How to pass parameter value from controller class to service class in sysoperation framwork batch processing

    Hi ievgen,

    After using line of code =>contract = controller.getDataContractObject(classStr(SysOperationDataContractClass));

    I am getting error

    SysOperationDataContractClass object not initialised.

    Stack trace

    (C)\Classes\SysOperationControllerClass1\main - line 11

  • Verified answer
    Mea_ Profile Picture
    Mea_ 60,274 on at
    RE: How to pass parameter value from controller class to service class in sysoperation framwork batch processing

    Hi B K Sharma,

    You need to get contract in main method and set value of parm method, here is an example www.schweda.net/blog_ax.php;wdl=en

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,263 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,112 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans