web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
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 737

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

I have the same question (0)
  • Verified answer
    Mea_ Profile Picture
    60,284 on at

    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

  • B K Sharma Profile Picture
    737 on at

    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
    B K Sharma Profile Picture
    737 on at

    Hey ievgen,

    Thanks Its working

    SysOperationControllerClass1 controller;

       SysOperationDataContractClass contract;

       controller = new SysOperationControllerClass1();

       controller.parmLoadFromSysLastValue(false);

       controller.parmExecutionMode(SysOperationExecutionMode::Synchronous);

       contract = controller.getDataContractObject('_contract');

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans