Sunday, 22 March 2020

get form datasource object in an Eventhandler in Dynamics 365 Finance X++

get a data-source in the event-handler for form method 'closeok', 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);

    }



}



Reference: 

https://rahulmsdax.blogspot.com/2019/05/how-to-get-form-datasource-object-in.html

No comments:

Post a Comment

POSTMAN D365

  Postman is useful to test the behavior of different OData class from/to D365FO. In this post we will see the steps to setup Postman with D...