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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Calling a form using batch jobs in Dynamics Ax 2012

(0) ShareShare
ReportReport
Posted on by 109

 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

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,970 Most Valuable Professional on at

    It's not possible. Forms run on client and there is no client when executing code on the batch server.

  • André Arnaud de Calavon Profile Picture
    301,134 Super User 2025 Season 2 on at

    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.

  • Faruk Durak Profile Picture
    109 on at

    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.

  • Martin Dráb Profile Picture
    237,970 Most Valuable Professional on at

    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?

  • Faruk Durak Profile Picture
    109 on at

    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?

  • André Arnaud de Calavon Profile Picture
    301,134 Super User 2025 Season 2 on at

    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.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 456 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans