I’m trying to transfer custom field values from ARInvoice (screen AR301000) to the GL Batch record created during release.
I added matching custom fields to both DACs via customization:
ARInvoice DAC fields:
-
UsrCustomerExtContractNbr(nvarchar(30)) – N° contrat plateforme -
UsrCustomerExtJournal(nvarchar(30)) – Journal plateforme -
UsrCustomerExtRefNbr(nvarchar(30)) – N° de facture plateforme
Batch DAC fields:
-
UsrExtContractNbr(nvarchar(30)) – N° contrat plateforme -
UsrExtJournal(nvarchar(30)) – Journal plateforme -
UsrExtRefNbr(nvarchar(30)) – N° de facture plateforme
I override the ARReleaseProcess.ReleaseDocProc method to handle the release logic, but when the batch is created, these custom fields remain blank in the GL Batch record.
Question:
Why aren’t the custom fields from ARInvoice being transferred to the GL Batch during release?
Here is ARReleaseProcess graph code:
using System;
using System.Collections.Generic;
using PX.Data;
using PX.Objects.AR;
using PX.Objects.GL;
using Cegid.Erp;
namespace PX.Objects.AR
{
public class ARReleaseProcess_Extension : PXGraphExtension<ARReleaseProcess>
{
public delegate List<ARRegister> ReleaseDocProcBasicDelegate(
JournalEntry je, ARRegister ardoc, List<Batch> pmBatchList);
[PXOverride]
public List<ARRegister> ReleaseDocProc(
JournalEntry je, ARRegister ardoc, List<Batch> pmBatchList,
ReleaseDocProcBasicDelegate baseMethod)
{
List<ARRegister> result = baseMethod(je, ardoc, pmBatchList);
if (ardoc == null || je == null || je.BatchModule.Current == null)
return result;
ARInvoice arInvoice = PXSelect<ARInvoice,
Where<ARInvoice.docType, Equal<Required<ARInvoice.docType>>,
And<ARInvoice.refNbr, Equal<Required<ARInvoice.refNbr>>>>>
.Select(Base, ardoc.DocType, ardoc.RefNbr);
if (arInvoice == null)
return result;
var arExt = arInvoice.GetExtension<ARRegisterExt>();
var batchExt = je.BatchModule.Current.GetExtension<BatchExt>();
if (arExt != null && batchExt != null)
{
batchExt.UsrExtContractNbr = arExt.UsrCustomerExtContractNbr;
batchExt.UsrExtJournal = arExt.UsrCustomerExtJournal;
batchExt.UsrExtRefNbr = arExt.UsrCustomerExtRefNbr;
je.BatchModule.Update(je.BatchModule.Current);
}
return result;
}
}
}