Hello everyone!
I’m trying to add a column from the BAccount table to the AR.52.10.00 Prepare Dunning Letter screen in order to provide more information.
I wrote the following code, which publishes without errors. However, when I check the screen, the data doesn’t appear, and I can’t figure out where I might have gone wrong or if I’m approaching this incorrectly:
using System;
using System.Collections;
using System.Collections.Generic;
using PX.Data;
using PX.Data.BQL;
using PX.Data.BQL.Fluent;
using PX.Objects.CM;
using PX.Objects.Common.Extensions;
using PX.Objects.GL.FinPeriods;
using PX.Objects;
using PX.Objects.AR;
using PX.Objects.CR;
using PX.Objects.CS;
namespace PX.Objects.AR
{
public class ARDunningLetterMaint_Extension : PXGraphExtension<PX.Objects.AR.ARDunningLetterMaint>
{
protected void ARDunningLetterList_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
{
var row = (ARDunningLetterProcess.ARDunningLetterList)e.Row;
if (row == null || row.BAccountID == null) return;
BAccount account = PXSelect< BAccount,
Where< BAccount.bAccountID, Equal<Required<BAccount.bAccountID>>>>
.Select(Base, row.BAccountID);
if (account != null)
{
var accountExt = PXCache<BAccount>.GetExtension<BAccountExt>(account);
var rowExt = cache.GetExtension<ARDunningLetterListExt>(row);
if (rowExt != null && accountExt != null)
{
rowExt.UsrSectGeo = accountExt?.UsrSecteurGeo;
cache.Update(row); // Force la mise à jour
}
}
}
}
}
The process:
- I created a new field.
- I added it as an extension to the DAC (ARDunningLetterList)
- I created an extension for ARDunningLetterMaint
Thanks in advance for your help !