web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

How to get form datasource object in a Eventhandler in Dynamics 365 Finance X++

Rahul Kiran Profile Picture Rahul Kiran 481
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);
    }

}

This was originally posted here.

Comments

*This post is locked for comments