2020R2中Acumatica客户页面Residential Delivery复选框绑定事件方法
解决方法
你遇到的报错是因为2020R2版本中DefLocationExt是Location DAC的扩展类,并不会作为独立缓存在CustomerMaint图中直接注册,所以直接以DefLocationExt为主体声明事件会找不到对应缓存。
你可以选择以下任意一种方式修改代码:
方式1:使用新式泛型事件声明(2020R2及以上版本推荐)
public class CustomerMaint_Extension : PXGraphExtension<CustomerMaint> { protected virtual void _(Events.FieldDefaulting<DefLocationExt, DefLocationExt.cResedential> e) { if (e.Row != null) { e.NewValue = true; } } }
方式2:绑定原生Location DAC的事件,直接操作扩展字段
public class CustomerMaint_Extension : PXGraphExtension<CustomerMaint> { protected virtual void Location_CResedential_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e) { var row = (Location)e.Row; if (row != null) { e.NewValue = true; } } }
两种方式都可以正常实现字段默认勾选的效果,代码部署后重启站点并清除浏览器缓存即可验证。
内容的提问来源于stack exchange,提问作者Ben Rothe
相关产品推荐
相关产品推荐

