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