acumatica - 在 APInvoice DAC 上使用 APRegisterExt
问题描述
我有这种情况,即自定义字段位于 APRegisterExt DAC 上。而 APInvoice 继承自 APRegister。
虽然,我在做
APRegisterExt InvoiceDataExt = InvoiceData.GetExtension<APRegisterExt>();
它在编译时没有错误,但在运行时它给了我错误
“getItemExtension 失败”
我只想以编程方式在自定义字段上设置一个值。
谢谢!!!
解决方案
这在一定程度上取决于您要覆盖的事件。例如,如果您在 APTran_RowSelecting 事件中,您将像这样拉入 APTranExt:
public void APTran_RowSelecting(PXCache sender, PXRowSelectingEventArgs e)
{
APTran row = (APTran)e.Row;
if (row == null) return;
APTranExt ext = sender.GetExtension<APTranExt>(row);
}
或者假设您在采购订单输入屏幕中,您点击 POLine_RowSelected 事件,但您需要行中库存项目的库存项目扩展值。你会做这样的事情:
// code to PXSelect the Inventory Item record
// and assign it to the inventoryitem var.
InventoryItemExt inventoryitemext = PXCache<InventoryItem>.GetExtension<InventoryItemExt>(inventoryitem);
其中一种模式应该适合您。
推荐阅读
- python - 如何解决浮点计算问题?
- javascript - 如何使用 child_process 从节点内运行 diskpart 命令?
- python - Pandas - 在 groupby 语句之后为均值和标准添加列
- html - 如何在纸上以多列呈现 HTML 表格?
- python-3.x - 基于多列的索引
- python - SyntaxError: invalid syntax — if 语句在单行中的 if 语句中
- amazon-web-services - 使用容量提供程序和 ECS 需要多长时间才能移除实例?
- android - 想要验证 Firebase 上的数据
- javascript - 无法调用“setTimeout”,因为函数 [1] 需要另一个参数
- r - 我无法从使用estimateNetwork() 计算的网络中提取强度中心值是什么?