Skip to main content
Answer

Custom fields from ARInvoice not copied to GL Batch during release in Acumatica 24r1

  • October 29, 2025
  • 2 replies
  • 36 views

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;
        }
    }
}

Best answer by DipakNilkanth

Hi ​@Mido97,

Could you please add the following line of code:

je.Persist();

right after this line.

je.BatchModule.Update(je.BatchModule.Current);

I believe you need to persist your changes to database.
Hope this helps!

2 replies

DipakNilkanth
Pro III
Forum|alt.badge.img+13
  • Pro III
  • Answer
  • October 29, 2025

Hi ​@Mido97,

Could you please add the following line of code:

je.Persist();

right after this line.

je.BatchModule.Update(je.BatchModule.Current);

I believe you need to persist your changes to database.
Hope this helps!


Forum|alt.badge.img+8
  • Captain II
  • October 29, 2025

@Mido97 

 

I would run the base method first, search for the record, assign the record to je.BatchModule.Current, then update the fields.

This way you have a record created, then update the fields.

The reason why the fields are null could be because je.BatchModule.Current could be null.

 

As ​@DipakNilkanth said, you should call the persist method after you have made your changes.