Hi @abdallaahmed61 , Could you perform the update using the graph object instead of DBupdate? could you show me how ? because i used this code and it gave me this errorPXCache targetCache = mixPaymentsGraph.Caches[typeof(MixPayments)];MixPayments targetRow = (MixPayments)targetCache.Current;if (targetRow == null){ targetRow = (MixPayments)targetCache.Insert(mix);}targetRow.RefNbr = refNbr;targetRow.DocType = tranType;targetCache.Update(targetRow);mixPaymentsGraph.Actions.PressSave(); and this code also gave me the same error mixPaymentsGraph.mix.Insert(mix);mix.RefNbr = inv.RefNbr;mix.DocType = inv.DocType;mixPaymentsGraph.mix.Update(mix);im putting this code in the Release button in the sales orders screen
public delegate IEnumerable ReleaseDelegate(PXAdapter adapter);[PXOverride]public IEnumerable Release(PXAdapter adapter, ReleaseDelegate baseMethod){ ARInvoice inv = Base.Document.Current; string soType = Base.Transactions.Current.SOOrderType; string soNbr = Base.Transactions.Current.SOOrderNbr; bool transactionExists = PXTransactionScope.IsScoped; try { var mixPayments = Pay.Select(soNbr, soType); MixPaymentsEntry mixPaymentsGraph = PXGraph.CreateInstance<MixPaymentsEntry>(); foreach (MixPayments mix in mixPayments) { if (mix.RefNbr is null || mix.DocType is null || mix.RefNbr == " <NEW>") { if (!transactionExists) { using (PXTransactionScope scope = new PXTransactionScope()) { PXDatabase.Update<MixPayments>(new PXDataFieldAssign<MixPayments.docType>(inv.DocType), new PXDataFieldAss
Unfortunately from this code, I can’t say what the exact problem is, but I can suggest some changes which will help to avoid errors like this. From this code, I saw you have a graph MixPaymentsEntry created for the MixPayments record. I hope this graph can be used for data manipulation in the MixPayments table. It is not necessary to use PXTransactionScope if the code uses only DB direct operation. In this code, you can just remove the PXTransactionScope. If the MixPayments records update depends on the Invoice Release process the best practice is to override the ReleaseInvoiceProc method and write your code before or after calling base method. public delegate void ReleaseInvoiceProcDelegate(List<ARRegister> list, bool isMassProcess); [PXOverride] public void ReleaseInvoiceProc(List<ARRegister> list, bool isMassProcess, ReleaseInvoiceProcDelegate releaseInvoiceProc) { using (PXTransactionScope scope = new PXTransactionScope()) { //TODO add your code here
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.