Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

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

(0) ShareShare
ReportReport
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));

}

 

 

 

*This post is locked for comments

  • 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,278 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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,904 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,605 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans