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
Good Post:) Suppose if I want to open form with multiple records of some criteria then how to achieve this when running on server? |
|
|
|
|
|
|
Imagine the following scenario: You have to create or update a record using a clas, which extends Sysoperation-Framework. After this database operation you have to open a particular form, which allows the user to modify the just created/modified record.
For such tasks i like to use the aferoperation()-method from the Controller-Class. By using the operationReturnvalue of the Service-Class within this method it is possible to process the record.
Example:
protected void afterOperation(SysOperationExecutionMode _executionMode, AifAsyncResult _asyncResult) { CustTable createdCustTable; SysInfoAction_Formrun sysInfoAction; void openFormThroughCode(CustTable _ct) { FormRun formRun; args localArgs = new args(); localArgs.name(formstr(CustTable)); localArgs.formViewOption(FormViewOption::Grid); localArgs.record(_ct); formRun = classFactory.formRunClass(localArgs); formRun.run(); formRun.wait(); } super(_executionMode, _asyncResult); if(this.getServiceClass().id() == classNum(TutorialSysOperationService)) { createdCustTable = this.operationReturnValue(); // TutorialSysOperationService.runService() returns CustTable record } if( !isRunningOnServer()) { openFormThroughCode(createdCustTable); } else { sysInfoAction = SysInfoAction_FormRun::newFormname(formStr(SalesTable)); sysInfoAction.parmCallerBuffer(createdCustTable); info(strFmt("Click here to open customer form"), "", sysInfoAction); } }