In my customization code I create a prepayment, after the sales order is persisted. How can I insert the prepayment record into the Adjustments cache? I insert an SOAdjust record and attempt to persist. But an error returns - a complaint about the field CuryInfoID.
public delegate void PersistDelegate();
[PXOverride]
public void Persist(PersistDelegate baseMethod)
{
baseMethod()
ARPaymentEntry entryGraph = PXGraph.CreateInstance<ARPaymentEntry>();
entryGraph.Clear();
ARPayment payment = new ARPayment { DocType = ARDocType.Prepayment, CustomerID = c.BAccountID };
payment.CuryOrigDocAmt = doc.CuryOrderTotal;
payment.AdjDate = doc.OrderDate;
payment.ExtRefNbr = doc.OrderNbr;
payment.PaymentMethodID = detail.PaymentMethodID;
//entryGraph.Document.View.Answer = WebDialogResult.Yes;
entryGraph.Document.Insert(payment);
entryGraph.Save.Press();SOAdjust adj = new SOAdjust();
adj.AdjgDocType = payment.DocType;
adj.AdjgRefNbr = payment.RefNbr;
adj.CuryAdjdAmt = doc.CuryOrigDocAmt;
adj.AdjgCuryInfoID = doc.CuryInfoID;
Base.Adjustments.Insert(adj);
Base.Save.Press();