Solved

PXProcessing Result columns are wrongly ordered

  • 30 January 2023
  • 2 replies
  • 77 views

Userlevel 2
Badge
The Reference Nbr. and Type Columns are switched for some reason

 

I am currently working on a customization which uses a custom processing form to call a modified release action. The modified release action is as follows:

 

public static void ReleaseProcess(List<ARPayment> list, bool isMassProcess)
{
ARPaymentEntry graph = PXGraph.CreateInstance<ARPaymentEntry>();

var docsToRelease = new List<ARRegister>(list.Count);

foreach (ARPayment payment in list)
{
if (payment.Status == ARDocStatus.Balanced)
{
docsToRelease.Add(payment);
}
}

if (docsToRelease.Count == 0) throw new PXException(PX.Objects.AR.Messages.Document_Status_Invalid);

ARDocumentRelease.ReleaseDoc(docsToRelease, isMassProcess, null, (ardoc, isAborted) => { });

for (int i = 0; i < list.Count; i++)
{
if (list[i] == null) continue;
var payment = list[i];

try
{
SetJournalInfo(payment, graph);
}
catch (Exception e)
{
PXProcessing<ARPayment>.SetError(i, e);
}
}
}

public static void SetJournalInfo(ARPayment payment, ARPaymentEntry graph)
{
if (payment != null)
{
if (payment.PaymentMethodID == PaymentMethodConstant.Giro || payment.PaymentMethodID == PaymentMethodConstant.Check)
{
var paymentExt = PXCache<ARRegister>.GetExtension<AcunomicARRegisterExt>(payment);

var batchNbr = payment.BatchNbr;

var journalEntryGraph = PXGraph.CreateInstance<JournalEntry>();

Batch entry = Batch.PK.Find(journalEntryGraph, BatchModule.AR, batchNbr);

if (entry != null)
{
var entryExt = PXCache<Batch>.GetExtension<AcunomicBatchExt>(entry);
entryExt.UsracnmClearedDate = paymentExt.UsracnmClearingDate;
entryExt.UsracnmRejectedDate = paymentExt.UsracnmRejectedDate;
entryExt.UsracnmPaymentRefNbr = payment.ExtRefNbr;
journalEntryGraph.BatchModule.Update(entry);

journalEntryGraph.Save.Press();
}

else
{
var msg = "Journal Entry does not exist";
throw new PXException(msg);
}
}
}
}

The main logic is to call the release action as usual but after the journal transaction is created, we set values for custom fields we made in the Batch. 

Is there a reason why the processing result comes out weirdly formatted like that? I’ve checked a topic created (https://community.acumatica.com/topic/show?tid=4594&fid=187) which has the same problem but the solution provided didn’t work for me (Or I maybe doing it wrong). Any help and insight would be greatly appreciated.

icon

Best answer by naufal58 2 February 2023, 03:43

View original

2 replies

Userlevel 2
Badge

Additional info, this is what the initialization of the processing action is like. I tried encasing the method in PXLongOperation however the release method still returns a messed up result screen:

 

protected virtual void _(Events.RowSelected<GiroCheckToProcessFilter> e)
{
GiroChecksList.SetProcessDelegate<ARPaymentEntry>(
(graph, payment, cancel) => {
List<ARPayment> list = new List<ARPayment>();
list.Add(payment);
var arpaymentgraph = PXGraph.CreateInstance<ARPaymentEntry>();
var graphExt = arpaymentgraph.GetExtension<ARPaymentEntry_Extension>();
arpaymentgraph.Document.Current = ARPayment.PK.Find(graph, payment);

if (e.Row.Action == ARDocStatus.Balanced)
{
PXLongOperation.StartOperation(arpaymentgraph, delegate ()
{
ARPaymentEntry_Extension.ReleaseProcess(list, true);
});
//ARPaymentEntry_Extension.ReleaseProcess(list, true);
}
else {
PXLongOperation.StartOperation(arpaymentgraph, delegate ()
{
ARPaymentEntry_Extension.RejectGiros(list, true);
});
}
//ARPaymentEntry_Extension.RejectGiros(list, true);
}
);
}

 

Userlevel 2
Badge

Hi, I found that running the customization on a deployed instance has no issues. The results screen is formatted with the correct columns. The only thing I noticed is that we have to wait a bit after creating the payment document before processing or else we get the “Another process has updated ….” error. 

But, I’d be very happy to any pointers on how to improve the code. TIA!

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