如何在table方法的委托中获取common.orig()?

时间:2019-01-09 14:45:45

标签: axapta x++ dynamics-ax-2012

我们有 Table 和字符串字段 Field 。您可以像这样覆盖 update()方法:

public void update()
{
    //check begin
    if (this.orig().Field != this.Field)
    {
        info('Changed');        
    }
    //check end

    super();
}

是否可以创建将进行检查的委托?代表必须与方法参数完全匹配,此处没有任何参数,否则他们可以使用 XppPrePostArgs ,但是我看不到如何获取_common _和 common.orig()的方法。从中。

如何在表方法的委托中获取 common.orig()?有可能吗?

我正在使用Microsoft Dynamics AX 2012。

1 个答案:

答案 0 :(得分:3)

您不能在表方法上有委托,但是可以有事件处理程序。参见:

您只需在表更新方法上放置一个事件前处理程序,然后类似于以下内容使用xppPrepostArgs

public static void updatePreEventHandler(xppPrepostArgs _args)
{
    CompanyInfo         companyInfo = _args.getThis();
    // Common              common      = _args.getThis(); // Alternatively

    if (companyInfo.orig().Name != companyInfo.Name)
    {
        info('Changed');
    }
}

enter image description here

相关问题