I am posting a Bill from the Bills and Adjustments. There is a UDF UsrExtProjectID being saved in the APRegister table.
When the JE gets posted for that bill, I want to set the UDF with the same name in the Batch table for the corresponding JE created from the bill.
I am overriding the PostBatchProc method in the PostGraph graph.
public class PostGraph_Extension : PXGraphExtension<PostGraph>
{
public delegate void PostBatchProcDelegate(Batch b);
bPXOverride]
public virtual void PostBatchProc(Batch b, PostBatchProcDelegate baseMethod)
{
baseMethod(b);
Here is the section of the code doing the work:
if (continueProcessingPID)
{
//get the Batch for the current transaction
Batch batch = SelectFrom<Batch>.Where<Batch.batchNbr.IsEqual<@P.AsString>>
.View.Select(Base, b.BatchNbr);
if (batch.Module == "AP")
{
//get the Batch for the current transaction
APRegister apRegister = SelectFrom<APRegister>.Where<APRegister.batchNbr.IsEqual<@P.AsString>>
.View.Select(Base, b.BatchNbr);
APRegisterExt itemAPExt = PXCache<APRegister>.GetExtension<APRegisterExt>(apRegister);
if (itemAPExt != null)
{
BatchExt itemBatchExt = PXCache<Batch>.GetExtension<BatchExt>(batch);
itemBatchExt.UsrProjectID = itemAPExt.UsrProjectID;
Base.Actions.PressSave();
}
}
}
Since the Batch table is not part of the method I am overriding, I suspect that is why the change is not being saved.
I am probably missing a simple line of code but I don’t know what it is.
Any help is greatly appreciated!