In this example I'll be showing you how to get a data-source in the event-handler for form method 'closeok'. In this example I'm using post event.
You can change the code for other form methods in the same way.
class SalesEditLines_EventHandler
{
/// <summary>
///
/// </summary>
/// <param name="args"></param>
[PostHandlerFor(formStr(SalesEditLines), formMethodStr(SalesEditLines, closeOk))]
public static void SalesEditLines_Post_closeOk(XppPrePostArgs args)
{
FormRun sender = args.getThis();
SalesParmUpdate salesParmUpdate;
salesParmUpdate = sender.dataSource(formdatasourcestr(SalesEditLines, SalesParmUpdate)).cursor();
info(salesParmUpdate.ParmId);
}
}
You can change the code for other form methods in the same way.
class SalesEditLines_EventHandler
{
/// <summary>
///
/// </summary>
/// <param name="args"></param>
[PostHandlerFor(formStr(SalesEditLines), formMethodStr(SalesEditLines, closeOk))]
public static void SalesEditLines_Post_closeOk(XppPrePostArgs args)
{
FormRun sender = args.getThis();
SalesParmUpdate salesParmUpdate;
salesParmUpdate = sender.dataSource(formdatasourcestr(SalesEditLines, SalesParmUpdate)).cursor();
info(salesParmUpdate.ParmId);
}
}