Acumatica 如何在2020R2将活动附加到客户屏幕上的住宅交付复选框?
我需要将Customers AR.30.30.00屏幕(Shipping选项卡)上住宅交付复选框的默认值更改为默认选中。请参见屏幕截图: 在2017R2中,此事件处理程序正常工作:Acumatica 如何在2020R2将活动附加到客户屏幕上的住宅交付复选框?,acumatica,Acumatica,我需要将Customers AR.30.30.00屏幕(Shipping选项卡)上住宅交付复选框的默认值更改为默认选中。请参见屏幕截图: 在2017R2中,此事件处理程序正常工作: public class CustomerMaint_Extension : PXGraphExtension<CustomerMaint> { protected virtual void LocationExtAddress_CResedential_FieldDefaulting(PXCa
public class CustomerMaint_Extension : PXGraphExtension<CustomerMaint>
{
protected virtual void LocationExtAddress_CResedential_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
{
var row = (LocationExtAddress)e.Row;
if (row != null)
{
e.NewValue = true; // checked by default
}
}
}
但这会导致运行时错误:
未能订阅图形PX.Objects.AR.CustomerMaint中的事件PX.Objects.AR.CustomerMaint_扩展::DefLocationExt_CResedential_FieldDefaulting。方法签名看起来像一个事件处理程序,但在自动初始化的缓存列表中找不到缓存DefLocationExt。从代码中删除未使用的事件处理程序
如何在2020R2中将事件附加到此字段?尝试通用事件处理程序,看看是否得到相同的结果 它可能看起来像这样
protected virtual void _(Events.FieldDefaulting<PX.Objects.CR.Standalone.Location.cResedential> e)
{
var row = (PX.Objects.CR.Standalone.Location)e.Row;
if (row != null)
{
e.NewValue = true; // checked by default
}
}
protected virtual void(Events.FieldDefaulting e)
{
var row=(PX.Objects.CR.Standalone.Location)e.row;
如果(行!=null)
{
e、 NewValue=true;//默认为选中
}
}
这导致了一个新错误:使用泛型类型“DefLocationExt”需要6个类型参数
。我尝试使用varrow=(CRLocation)e.row代码>而不是var row=(DefLocationExt)e.row代码>,未导致任何错误,但我不确定事件是否已触发。复选框的默认值没有更改。请尝试此操作。受保护的虚拟void(Events.FieldDefaulting e){var row=(PX.Objects.CR.Standalone.Location)e.row;if(row!=null){e.NewValue=true;//默认检查}}很可能是对DefLocationExt的强制转换导致了问题。我已将其更改为转换为PX.Objects.CR.Standalone.Location
protected virtual void _(Events.FieldDefaulting<PX.Objects.CR.Standalone.Location.cResedential> e)
{
var row = (PX.Objects.CR.Standalone.Location)e.Row;
if (row != null)
{
e.NewValue = true; // checked by default
}
}