Hi,
We have MS Dynamics AX 2012 R3, We are trying to settle a project invoice that contains more than 200 lines.
Unfortunately, while trying to settle the invoice the system is hanging. We tried to debug the code then we found that the code is looping into a specific method.
Class\CustVoucher\updateProjTransPosting
This method contains a while loop that 'select for update' and 'insert' new records into 'projTransPosting' table. If we tried to settle any other invoice that contains a fewer number of lines, it is working normally.
I tried the following URL by using "RecordInsertList" but unfortunately I still have the same issue.
https://community.dynamics.com/ax/f/microsoft-dynamics-ax-forum/289490/infinite-loop/1046427#1046427
Class\CustVoucher\updateProjTransPosting
while select forupdate projTransPostingOrig
where projTransPostingOrig.Voucher == _voucherNo &&
projTransPostingOrig.PaymentStatus == ProjPaymentStatus::ExpectedPayment
{
// Check to see if the partial payment needs to be done
if (_partialPayment)
{
// Copy the row to be inserted
ProjTransPostingInsert.data(projTransPostingOrig);
// Copy the original amount and qty
originalQty = projTransPostingOrig.Qty;
originalAmount = projTransPostingOrig.AmountMst;
// get percentage of partial payment
partialAmount = Currency::amount(originalAmount * _percentagePayment);
partialQty = decRound(originalQty * _percentagePayment, 2);
// insert new record
ProjTransPostingInsert.AmountMst = originalAmount - partialAmount;
ProjTransPostingInsert.Qty = originalQty - partialQty;
ProjTransPostingInsert.PaymentStatus = ProjPaymentStatus::ExpectedPayment;
projTransPostingInsert.insert();
// We need to edit the existing record to reflect the partial payment
projTransPostingOrig.AmountMst = partialAmount;
projTransPostingOrig.Qty = partialQty;
}
projTransPostingOrig.PaymentStatus = _paymentStatus;
projTransPostingOrig.PaymentDate = _paymentDate;
projTransPostingOrig.update();
}