Announcements
I want to call a form in batch job using RunBaseBatch but I am getting an error.
I have simple code in RunBaseBatch class.:
public void doIt()
{
Args args = new Args();
new MenuFunction(menuItemOutputStr(LedgerBalanceSheetDimPrint), MenuItemType::Output).run(args);
}
I get the error after CIL and Restart.:
This menu item calls the Ax standard LedgerBalanceSheetDimPrint class.
Microsoft.Dynamics.Ax.Xpp.InvalidRemoteCallException: Exception of type 'Microsoft.Dynamics.Ax.Xpp.InvalidRemoteCallException' was thrown.
at Dynamics.Ax.Application.RunBase.promptOnClient(Int32 classId, Object[] packed)
at Dynamics.Ax.Application.RunBase.Promptprim() in RunBase.promptPrim.xpp:line 16
at Dynamics.Ax.Application.RunBase.Prompt() in RunBase.prompt.xpp:line 12
at Dynamics.Ax.Application.RunBaseBatch.Prompt() in RunBaseBatch.prompt.xpp:line 30
at Dynamics.Ax.Application.LedgerBalanceSheetDimPrint.main(Args args) in LedgerBalanceSheetDimPrint.main.xpp:line 11
at LedgerBalanceSheetDimPrint::Main(Object[] )
at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)
at Dynamics.Ax.Application.MenuFunction.Run(xArgs _args, Boolean ) in MenuFunction.run.xpp:line 76
at Dynamics.Ax.Application.MenuFunction.Run(xArgs _args)
at Dynamics.Ax.Application.AutoGenerateReportsYearly.Doit() in AutoGenerateReportsYearly.doIt.xpp:line 7
at Dynamics.Ax.Application.AutoGenerateReportsYearly.Run() in AutoGenerateReportsYearly.run.xpp:line 15
at Dynamics.Ax.Application.BatchRun.runJobStaticCode(Int64 batchId) in BatchRun.runJobStaticCode.xpp:line 54
at Dynamics.Ax.Application.BatchRun.runJobStatic(Int64 batchId) in BatchRun.runJobStatic.xpp:line 13
at BatchRun::runJobStatic(Object[] )
at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)
at BatchIL.taskThreadEntry(Object threadArg)
I also get this error when I try the same operation with SysOperation class.
Microsoft.Dynamics.Ax.Xpp.InvalidRemoteCallException: Exception of type 'Microsoft.Dynamics.Ax.Xpp.InvalidRemoteCallException' was thrown.
at Dynamics.Ax.Application.RunBase.promptOnClient(Int32 classId, Object[] packed)
at Dynamics.Ax.Application.RunBase.Promptprim() in RunBase.promptPrim.xpp:line 16
at Dynamics.Ax.Application.RunBase.Prompt() in RunBase.prompt.xpp:line 12
at Dynamics.Ax.Application.RunBaseBatch.Prompt() in RunBaseBatch.prompt.xpp:line 30
at Dynamics.Ax.Application.LedgerBalanceSheetDimPrint.main(Args args) in LedgerBalanceSheetDimPrint.main.xpp:line 11
at LedgerBalanceSheetDimPrint::Main(Object[] )
at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)
at Dynamics.Ax.Application.MenuFunction.Run(xArgs _args, Boolean ) in MenuFunction.run.xpp:line 76
at Dynamics.Ax.Application.MenuFunction.Run(xArgs _args)
at Dynamics.Ax.Application.KlForCustTesterDataService.Testcustomer(KlForCustTesterDataContract _klForCustTesterDataContract) in KlForCustTesterDataService.testCustomer.xpp:line 5
at KlForCustTesterDataService::testCustomer(Object , Object[] )
at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeInstanceCall(Object instance, String MethodName, Object[] parameters)
at Microsoft.Dynamics.Ax.Xpp.DictClass.Callobject(String _methodName, XppObjectBase _Called, Object[] varArgs)
at Dynamics.Ax.Application.SysOperationServiceController.Runoperation(Boolean _async) in SysOperationServiceController.runOperation.xpp:line 88
at Dynamics.Ax.Application.SysOperationServiceController.Run() in SysOperationServiceController.run.xpp:line 27
at Dynamics.Ax.Application.BatchRun.runJobStaticCode(Int64 batchId) in BatchRun.runJobStaticCode.xpp:line 54
at Dynamics.Ax.Application.BatchRun.runJobStatic(Int64 batchId) in BatchRun.runJobStatic.xpp:line 13
at BatchRun::runJobStatic(Object[] )
at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)
at BatchIL.taskThreadEntry(Object threadArg)
By calling this form, I have it save the data on the screen to an Excel file. It works when I call it with menu item.
Version is Dynamcis ax 2012 R2 6.2.1000.4051
Hi Faruk,
I don't know the details of this form, but all calculations can be done in classes. I don't know what exact logic you have on this form, but might it be on the wrong place. You can then decide to have SSRS for a report or export to file.
I have to use the form because I'm exporting the data from the form to an Excel. I have complex data on the form and it takes a lot of time to do this with SSRS. Menu item invokes a class, class invokes form. I export the forms to Excel file. Could there be another way to do this?
Wouldn't it be better if you bypassed the form?
What's the exact thing that you're unable to implement without taking dependency on the graphical user interface?
Hello Martin and André,
Thank you for your answers. I suggested to my client that we can't do this with batches and that we can develop a Windows Service application instead of a batch job. The .Net Business Connector will fix this. Thanks.
Hi Faruk,
As mentioned by Martin, this is not possible. It looks like you are not trying to open a form, but want to start running a report. From the batch job, it would be possible to add the report execution as new batch job via coding.
It's not possible. Forms run on client and there is no client when executing code on the batch server.
André Arnaud de Cal...
294,165
Super User 2025 Season 1
Martin Dráb
232,968
Most Valuable Professional
nmaenpaa
101,158
Moderator