Friday, 17 May 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

Adding a newline into a string in C# and X++

Below is the sample code we can use for  adding a newline after every occurrence of "@" symbol in the string in C#   using System...