能否为Acumatica自定义屏幕添加用户定义字段?
自定义Acumatica屏幕启用用户定义字段的方法
自定义屏幕完全可以启用用户定义字段(UDF)功能,只需调整DAC和屏幕的相关配置,具体步骤如下:
配置DAC核心属性
自定义DAC必须继承IBqlTable和IUsrCustomFields接口,同时添加[PXCacheName]和[PXPrimaryGraph]属性绑定对应屏幕。另外需要在DAC中预定义基础UDF字段(如字符串、数字、日期类型),示例代码:[PXCacheName("我的自定义实体")] [PXPrimaryGraph(typeof(MyCustomScreen))] public class MyCustomEntity : IBqlTable, IUsrCustomFields { [PXDBIdentity(IsKey = true)] [PXUIField(DisplayName = "ID")] public virtual int? MyCustomEntityID { get; set; } public abstract class myCustomEntityID : PX.Data.BQL.BqlInt.Field<myCustomEntityID> { } // UDF基础字段定义 [PXDBString(255)] [PXUIField(DisplayName = "用户字段1")] public virtual string UsrField1 { get; set; } public abstract class usrField1 : PX.Data.BQL.BqlString.Field<usrField1> { } [PXDBInt] [PXUIField(DisplayName = "用户字段2")] public virtual int? UsrField2 { get; set; } public abstract class usrField2 : PX.Data.BQL.BqlInt.Field<usrField2> { } }调整屏幕Graph与ASPX配置
在屏幕Graph类中注册UDF缓存:public PXSelect<UsrCustomField, Where<UsrCustomField.entityType, Equal<Current<MyCustomEntity.entityType>>>> CustomFields;然后在屏幕的ASPX文件中,添加UDF控件到内容区域:
<px:PXUserDefinedFields runat="server" ID="edUDF" DataField="UsrCustomFields" />启用系统功能开关
在Acumatica系统的「System > Management > Features」中,勾选「User Defined Fields」功能。完成以上配置后,自定义屏幕右上角会出现和标准屏幕一致的「User Defined Fields」设置选项,可直接添加自定义字段。
内容的提问来源于stack exchange,提问作者pmfith
相关产品推荐
相关产品推荐

