Table Update Event Handler

I am exploring the possibilities of the new delegate and event subscription template in AX 2012.

I'm currently looking to determine when a particular field has been changed, for example, when SalesTable.SalesStatuschanged to SalesStatus::Invoiced.

I created the following post-event handler and is bound to the SalesTable.Update method;

public static void SalesTable_UpdatePosteventHandler(XppPrePostArgs _args)
{
    Info("Sales Update Event Handler");
}

Now I know what I can get SalesTablefrom _args, but how can I determine that the field has changed? I really could use the before and after version, which makes me think I am subscribing to the wrong event here.

+4
source share
1 answer

update , pre . PriceGroup CustTable, CustTableEventHandler, :

public static void preUpdateHandler(XppPrePostArgs _args)
{
    CustTable custTable = _args.getThis();
    if (custTable.PriceGroup != custTable.orig().PriceGroup)
        info(strFmt("Change price group from '%1' to '%2'", custTable.orig().PriceGroup, custTable.PriceGroup));
}

A post , orig() . , doUpdate, .

aosValidateUpdate on CustTable, , doUpdate. AOS.

public boolean aosValidateUpdate()
{
    boolean ret = super();
    if (this.PriceGroup != this.orig().PriceGroup)
        info(strFmt("Change price group from '%1' to '%2'", this.orig().PriceGroup, this.PriceGroup));
    return ret;
}

Application.eventUpdate. :

, , , ​​ .

​​ , DatabaseLog , , logType, EventUpdate. , ​​ . , logUpdate. , .

> . , (, ).

.

+7

All Articles