Acumatica AP301000切换分支时获取分支扩展信息失败排查
问题:AP301000切换分支时部分分支无法获取BAccount扩展数据
环境与需求
- Acumatica版本:Acumatica Cloud ERP 2025 R1 Build 25.101.0153+
- 需求:在*Bills and Adjustments(AP301000)*页面切换分支时,自动填充分支的扩展数据
实现代码
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; }
问题现象
- 分支ID为16时,代码正常运行,日志输出
Id: 16 - 切换到分支ID为20时,日志输出
Id: 20后报错Branch BAccount not found 1,已确认两种场景均传入了对应分支ID - 相同代码在Invoices和Invoices & Memos模块中,对所有分支都能正常执行
内容的提问来源于stack exchange,提问作者Adrien
相关产品推荐
相关产品推荐

