Invoicing error - only with CIL activated

This question is answered

When we invoice a sales order we get an error with the text shown below. If I remove the CIL-checkmark in the user options it runs successfully. 

I have traced the error to the method initInvoiceHeaderFromSourceTable on the class SalesInvoiceJournalCreate that calls the method initFromSalesTable on the table CustInvoiceJour. 

When running with the CIL checkmark set true the method initFromSalesTable exits successfully however it does not continue the execution in the method initInvoiceHeaderFromSourceTable. Instead it throws the below error message.

The main result is that we cannot post an invoice on the customers installation without removing the CIL checkmark.

Thanks in advance,

.søren

 

The error message thrown:

Exception has been thrown by the target of an invocation.

An error occurred during update

 

Microsoft.Dynamics.Ax.Xpp.ErrorException: Exception of type 'Microsoft.Dynamics.Ax.Xpp.ErrorException' was thrown.

   at Dynamics.Ax.Application.FormletterService.Run() in FormletterService.run.xpp:line 241

   at Dynamics.Ax.Application.FormletterService.Postsalesorderinvoice(SalesFormLetterInvoiceContract _contract) in FormletterService.postSalesOrderInvoice.xpp:line 14

   at FormletterService::postSalesOrderInvoice(Object , Object[] )

   at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeInstanceCall(Object instance, String MethodName, Object[] parameters)

   at Dynamics.Ax.Application.SysOperationServiceController.Runoperation(Boolean _async) in SysOperationServiceController.runOperation.xpp:line 113

   at Dynamics.Ax.Application.SysOperationServiceController.runServiceOperation(Object[] parameters) in SysOperationServiceController.runServiceOperation.xpp:line 22

   at SysOperationServiceController::runServiceOperation(Object[] )

   at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)

   at Dynamics.Ax.Application.SysDictClass.invokeStaticMethod(Object[] _params) in SysDictClass.invokeStaticMethod.xpp:line 32

   at SysDictClass::invokeStaticMethod(Object[] )

   at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)

   at Microsoft.Dynamics.Ax.Xpp.PredefinedFunctions.runAsInvoke(String className, String staticMethodName, Object[] parms, Object[]& exportInfolog)

 

Verified Answer
  • Good news: I have fixed the error

    Bad news: I am not exactly sure how I did it.

    I tried shutting down the AOS, deleted the CIL-files, restarted, compiled and build the CIL. Still no luck. Then I put in some info("...") calls here and there to try and get close to what went wrong. Still no luck.

    I removed a couple of customisations. Still no luck.

    Then I removed the info("...") calls and now I all of the sudden could do the invoice.

    I reintroduced the customisations i removed earlier and it still works ...

    My bet is that there was some layer mix up somewhere that got fixed when I customised and uncustomised a bit back and forth. A bit like fiddling with the ClassInternalHeaders in earlier versions.

    Thanks Xander for your input. :)

    .søren

All Replies
  • I assume you already tried a full CIL generation?

  • Full CIL, full compile, restart AOS ... you name it. :)

  • Can you debug it with Visual Studio or can you restore the customers database on your development env. ? I once got this error and after debugging in VS it turned out to be a missing/invalid mainaccount.

  • Good news: I have fixed the error

    Bad news: I am not exactly sure how I did it.

    I tried shutting down the AOS, deleted the CIL-files, restarted, compiled and build the CIL. Still no luck. Then I put in some info("...") calls here and there to try and get close to what went wrong. Still no luck.

    I removed a couple of customisations. Still no luck.

    Then I removed the info("...") calls and now I all of the sudden could do the invoice.

    I reintroduced the customisations i removed earlier and it still works ...

    My bet is that there was some layer mix up somewhere that got fixed when I customised and uncustomised a bit back and forth. A bit like fiddling with the ClassInternalHeaders in earlier versions.

    Thanks Xander for your input. :)

    .søren