Reputation: 133
I tried to override an exisiting method but after i published I get this error.
Attempt by method 'Wrapper.PX.Objects.AR.Cst_ARPaymentEntry.ARPayment_RowSelectedGeneratedWrapper(PX.Objects.AR.ARPaymentEntry, PX.Data.PXCache, PX.Data.PXRowSelectedEventArgs)' to access method 'PX.Objects.AR.ARPaymentEntry_Extension.ARPayment_RowSelected(PX.Data.PXCache, PX.Data.PXRowSelectedEventArgs)' failed.
when I tried to remove the PXOverride attribute no error occured. I'm using 5.10.072 version.
[PXOverride]
protected void ARPayment_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
}
Upvotes: 0
Views: 938
Reputation: 586
The problem is that you try to override an event handler - not a common virtual method of the BLC. To do this one has to use a different approach. Namely, you need to declare the event handler without the PXOverride
attribute, but with an additional argument of type PXRowSelected
and then either call it or not based on your internal logic. Here is an example of such a declaration:
protected void ARPayment_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected invokeBaseHandler)
{
/* your custom event handling logic here */
if(/* your custom condition may go here */)
invokeBaseHandler(cache, e);
/* some more of your logic here if needed */
}
Note that if you simply want your handler be executed along with the base one, you don't need the additional argument - simply declare the handler with your code and it will be called after the original handlers.
You may find much more information and explanatiions on this topic in the help article located under Help > Customization > Examples of Functional Customization > Adding or Altering BLC Event Handler in any instance of Acumatica.
Upvotes: 4