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 (listsi] == null) continue;
var payment = listsi];
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.