Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Friday, January 25, 2019

Getting the field Name in Table modified field event handler in D365

Hi,

can be achieved by args.getArgNum(1);

class XXXXCustTable_EventHandler
{
    /// <summary>
    ///
    /// </summary>
    /// <param name="args"></param>
    [PostHandlerFor(tableStr(CustTable), tableMethodStr(CustTable, modifiedField))]
    public static void CustTable_Post_modifiedField(XppPrePostArgs args)
    {
        CustTable               custTable   =  args.getThis() as CustTable;

        switch (args.getArgNum(1))
        {
            case fieldNum(custTable, CustGroup):
                if(!CustTable.OverrideSpecialMarginCode)
                {
                    custTable.SpecialMarginCode = CustGroup::find(
                                  custTable.CustGroup).SpecialMarginCode;
                }
                break;
        }
    }

}
Thanks,

No comments:

Post a Comment

How find size of recordsortedlist in D365/AX 2012

Hi, This is the continuity of the previous article where we are now getting the size of recordsortedlist . if(recordsortedlist.len() >1) ...