Acumatica 在APInvoice DAC上使用RegisterText

Acumatica 在APInvoice DAC上使用RegisterText,acumatica,Acumatica,在这种情况下,自定义字段位于RegisterExt DAC上。 而APInvoice是从注册者那里继承的 不过,我正在做 APRegisterExt InvoiceDataExt=InvoiceData.GetExtension 它在编译时没有错误,但在运行时它给了我错误 getItemExtension失败 我只想以编程方式在自定义字段上设置一个值 谢谢 这稍微取决于您要覆盖的事件。 例如,如果您在a APTran_RowSelecting事件中,您将按如下方式拉入APTranExt: pub

在这种情况下,自定义字段位于RegisterExt DAC上。 而APInvoice是从注册者那里继承的

不过,我正在做

APRegisterExt InvoiceDataExt=InvoiceData.GetExtension

它在编译时没有错误,但在运行时它给了我错误

getItemExtension失败

我只想以编程方式在自定义字段上设置一个值


谢谢

这稍微取决于您要覆盖的事件。 例如,如果您在a 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);
        }
// code to PXSelect the Inventory Item record 
// and assign it to the inventoryitem var.
InventoryItemExt inventoryitemext = PXCache<InventoryItem>.GetExtension<InventoryItemExt>(inventoryitem);
或者,假设您在采购订单输入屏幕中,点击POLine_Row Selected事件,但您需要行中库存项目的库存项目扩展值。您可以这样做:

public void APTran_RowSelecting(PXCache sender, PXRowSelectingEventArgs e)
        {
            APTran row = (APTran)e.Row;
            if (row == null) return;
            APTranExt ext = sender.GetExtension<APTranExt>(row);
        }
// code to PXSelect the Inventory Item record 
// and assign it to the inventoryitem var.
InventoryItemExt inventoryitemext = PXCache<InventoryItem>.GetExtension<InventoryItemExt>(inventoryitem);

其中一种模式应该适合你。

经过几周的实验

我找到了解决办法

我在图中扩展了它

在我将数据插入缓存之后

APRegisterExt GetAPExtension=APGraph.Document.Current.GetExtension


这个把戏对我有用。也谢谢你的建议!:

看起来一切都定义正确。由于它是单个值,您是否尝试过AProw.GetExtension.UsrValue=ValueToSet?