Tuesday, May 30, 2023

D365 F&O: Event handler- Retrieve some values from data source in form

 

D365 Finance and Operations: How to get the value datasource of form in an Event handler in Dynamics 365 Finance & Operations X++ method SalesEditLines_Post_closeOk

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

{

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

    }

}

No comments:

Post a Comment

D365 FinOps - How call a runnable class with URL parameters

We are already familiar with calling D365FO URL menu items or forms or Runnable class. To recap, I am giving few samples below To call  Disp...