Hello,
I have a strange problem with a standard ax functionality.
The problem is that when the code is running as CIL (in batch) the following exception was thrown:
Unable to cast object of type 'System.Object[]' to type 'Microsoft.Dynamics.Ax.Xpp.Common.
Here is the source:
class SomeClass { List scheduleLines } public void new() { scheduleLines = new List(Types::Container); } protected void addToList { SalesQuotationLine salesQuotationLine; while select salesQuotationLine where salesQuotationLine.QuotationId == xxxx { scheduleLines.addEnd([salesQuotationLine]); } } protected SalesQty totalQty() { SalesQty qty; SalesQuotationLine salesQuotationLine; ListEnumerator scheduleLinesEnumerator = scheduleLines.getEnumerator(); scheduleLinesEnumerator.reset(); while (scheduleLinesEnumerator.moveNext()) { salesQuotationLine = scheduleLinesEnumerator.current(); qty += salesQuotationLine.SalesQty; } return qty; }
The line that throws the exception is in method totalQty().
Here is it:
salesQuotationLine = scheduleLinesEnumerator.current();
Does anyone faced such a problem?
Thanks.