Event Handlers in Dynamics AX 7 and Dynamics AX 365 - D365
If you want to create new event handler then have to create a class and define.
Example:
class VendTableHandler
{
[PostHandlerFor(tableStr(VendTable), tableMethodStr(VendTable, insert))] // Post even Handler
public static void VendTable_Post_insert(XppPrePostArgs _args)
{
VendTable vendTable = _args.getThis();
_args.setReturnValue(VendTable::exists(vendTable.AccountNum));
}
}
// For Pre event handler
// [PreHandlerFor(tableStr(VendTable), tableMethodStr(VendTable, insert))]
Note: once you created an event handler for a table method. You can see + symbol for the method left side.
Example:
class VendTableHandler
{
[PostHandlerFor(tableStr(VendTable), tableMethodStr(VendTable, insert))] // Post even Handler
public static void VendTable_Post_insert(XppPrePostArgs _args)
{
VendTable vendTable = _args.getThis();
_args.setReturnValue(VendTable::exists(vendTable.AccountNum));
}
}
// For Pre event handler
// [PreHandlerFor(tableStr(VendTable), tableMethodStr(VendTable, insert))]
Note: once you created an event handler for a table method. You can see + symbol for the method left side.
No comments:
Post a Comment