Friday, May 17, 2019

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

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);
    }

}

1 comment:

  1. The website is looking bit flashy and it catches the visitors eyes. Design is pretty simple and a good user friendly interface.
    pożyczka w 5 minut bez zaświadczeń

    ReplyDelete

Why do users often get confused about Dynamics 365 Customer Engagement (D365 CE), Dataverse, and the Power Platform?

  The Microsoft ecosystem for business applications can sometimes be difficult to navigate, especially when discussing Dynamics 365 Customer...