Search code examples
acumatica

Calling delegate for Acumatica Event with the _ event notation


Previously, in order to inject code in the middle of an event handler, you could use the code:

protected virtual void Customer_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected del)
{
    // run before the base event 
    del?.Invoke(cache, e);
    // run after the base event 
}

With the new event style:

protected virtual void _(Events.RowSelected<Customer> e)

What is the proper way to call the delegate?


Solution

  • I found an example in the code provided in the extension library for APInvoiceEntryExt.cs. The following code is how you would accomplish this:

    protected virtual void _(Events.RowSelected<Customer> e, PXRowSelected del)
    {
        // run before the base event 
        del?.Invoke(e.Cache, e.Args);
        // run after the base event     
    }