You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Acumatica:PXSelector添加分部安全限制及SubAccount特性查询

Acumatica开发问题解答

一、给PXSelector添加分部权限限制

要将GL104030中配置的分部权限应用到你的PXSelector,需修改PXSelector特性的BQL查询,加入用户允许访问的分部筛选条件。修改后的代码如下:

#region Usranalytique
[PXDBInt]
[PXDefault]
[PXSelector(
    typeof(Sub.subID),
    typeof(Sub.subCD),
    typeof(Sub.description),
    typeof(Sub.branchID),
    DescriptionField = typeof(Sub.description),
    SubstituteKey = typeof(Sub.subCD),
    Where = typeof(Where<Sub.branchID, In<Current<AccessInfo.allowedBranchIDs>>>)
)]  
[PXUIField(DisplayName="Analytique")]
public virtual int? Usranalytique { get; set; }
public abstract class usranalytique : PX.Data.BQL.BqlInt.Field<usranalytique> { }
#endregion
  • 核心改动是在PXSelector中新增Where参数,通过AccessInfo.allowedBranchIDs获取当前用户有权限访问的分部ID列表,实现对应分部下子账户的筛选。
  • 若系统启用多分部特性但需调整权限逻辑,可根据实际需求修改BQL条件。

二、SubAccount特性官方说明的查询位置

你可以通过以下两种途径获取[SubAccount]特性的官方说明:

  1. Visual Studio元数据查看:在代码中右键点击SubAccount特性,选择「转到定义」,查看特性自带的注释说明,Acumatica官方特性均附带详细的参数解释与使用场景描述。
  2. Acumatica系统内帮助文档:在Acumatica系统的「帮助中心」中,找到「自定义开发指南」,搜索「SubAccount Attribute」即可获取官方编写的特性使用文档,包含参数定义、适用场景、示例代码等内容。

内容的提问来源于stack exchange,提问作者Xavier LARTEM

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 14:54:57