ARTICLE AD BOX
I am working with this version of Acumatica: Acumatica Cloud ERP 2025 R1Build 25.101.0153 +
I would like the extended data for the Branch to be populated whenever the Branch is changed in Bills and Adjustments.
I got this piece of code:
using GLBranch = PX.Objects.GL.Branch; public static BAccountExt GetBranchContext(PXGraph graph, int? Id) { // Get the active branch GLBranch activeBranch = PXSelect<GLBranch, Where<GLBranch.branchID, Equal<Required<GLBranch.branchID>>>> .Select(graph, Id); PXTrace.WriteInformation($"Id: {Id}"); if (activeBranch == null) throw new PXException("❌ Active Branch not found 1"); BAccount branchAccount = PXSelect<BAccount, Where<BAccount.bAccountID, Equal<Required<BAccount.bAccountID>>>> .Select(graph, activeBranch.BAccountID); if (branchAccount == null) throw new PXException("❌ Branch BAccount not found 1"); BAccountExt branchExt = PXCache<BAccount>.GetExtension<BAccountExt> (branchAccount); if (branchExt == null) throw new PXException("❌ BranchExt not found 1"); return branchExt; }This works fine for one of the branches, got this Id from trace on successful case
Id: 16
But when switch to other branch I got this error in trace:
Id: 20
Branch BAccount not found 1
In both cases the input Id is comming
I used this same piece of code in Invoices and Invoices & Memos and works fine for all the branches
