Hi All,
I introduced a custom class which basically creates additional salesLine records against a sales order.
The class is called from the SalesPackingSlipJournalPost class from the method - endPostLine.
The code is set to execute only in certain company/legal entity.
I start this off after the super()
if(curExt() == 'ABC')
{
call custom class which is declared in the class declaration of SalesPackingSlipJournalPost
}
My issue is that the code works and runs fine in company ABC but in company ABB it produces the error
Exception has been thrown by the target of an invocation.
The error only occurs when client runs in CIL.
I have tried to recompile CIL fully and incrementally and I have even cleared the xppil folder as well without any joy.
As a novice to debugging with visual studio I put a break point in at line 217 of the FormLetterService class.
Further analysis gives the following:
Invalid cast from 'System.Decimal' to 'Dynamics.Ax.Application.AG_CreateOrderLineDelRemainder'.
Could this have anything to do with either declaring the custom class AG_CreateOrderLineDelRemainder in the class declartion of SalesPackingSlipJournalPost or is it an issue using curExt in the endPostLine?