Question

Receiving PXLockException When Updating Payment Prior to Capture

  • 4 October 2023
  • 0 replies
  • 31 views

Hello,

 

I am trying to update the AR Payment when the capture button is clicked, prior to capturing. I need to add Entry Charges programmatically and then let the capture do the rest of its base processing. I have the below code but during the Save, I am receiving a PXLockException error, and a message that another process has updated the ARRegister. Can you please provide guidance on how I can properly update the record prior to the base method and let basemethod do its process based on the updated record?

public class ARPaymentEntry_PaymentTransactionExt : PXGraphExtension<ARPaymentEntryPaymentTransaction, ARPaymentEntry>
{
public static bool IsActive() => PXAccess.FeatureInstalled<PX.Objects.CS.FeaturesSet.integratedCardProcessing>();
public override void Initialize() => base.Initialize();
public delegate IEnumerable CaptureCCPaymentDelegate(PXAdapter adapter);

[PXOverride]
public virtual IEnumerable CaptureCCPayment(PXAdapter adapter, CaptureCCPaymentDelegate baseDelegate)
{
Base.Save.Press();
//List<ARRegister> ret = new List<ARRegister>();

foreach (ARPayment ardoc in adapter.Get<ARPayment>())
{

var ext = ardoc.GetExtension<BMEPARRegisterExt>();
ARPayment payment = Base.Document.Current;
ARPaymentChargeTran Charge = new ARPaymentChargeTran
{
DocType = payment.DocType,
RefNbr = payment.RefNbr,
EntryTypeID = "TEST",
CuryTranAmt = 20.00m
};


Base.PaymentCharges.Insert(Charge);
Base.Document.Update(payment);
Base.Persist();
}

var ret = baseDelegate?.Invoke(adapter);

return ret;
}

}

 


0 replies

Be the first to reply!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved