Skip to main content
Solved

Problem overriding extension method

  • December 14, 2023
  • 2 replies
  • 185 views

Forum|alt.badge.img+1

Hello, I want to run some code when the ‘Line Details’ button is clicked on Purchase Receipts. Overriding the appropriate method seems like the way to go but I’m struggling to get the code to work. 

This is a screen shot with the button hightlighted

The button calls a method called ShowSplits, this displays a SmartPanel. I want to do something when the SmartPanel closes. Unfortunately this method is in an extension (POReceiptLineSplittingExtension) so I’ve tried to define the extensions in the class definition for my extension. My code looks like this

public class POReceiptLineSplittingExtension_Extension : PXGraphExtension<POReceiptLineSplittingExtension, LineSplittingExtension<POReceiptEntry, POReceipt, POReceiptLine, POReceiptLineSplit>, POReceiptEntry>
{
	public delegate IEnumerable ShowSplitsDelegate(PXAdapter adapter);
	[PXOverride]
	public IEnumerable ShowSplits(PXAdapter adapter, ShowSplitsDelegate baseMethod)
	{
		var ret = baseMethod(adapter);
		//Do Something
		return ret;
	}
}

This compiles but when I open the Purchase Receipts screen, the page crashes, I get the following message.

Graph extension PX.Objects.PO.GraphExtensions.POReceiptEntryExt.POReceiptLineSplittingExtension_Extension cannot refer to the following abstract graph extensions that are not marked as [PXProtectedAccess]: PX.Objects.IN.GraphExtensions.LineSplittingExtension`4[PX.Objects.PO.POReceiptEntry,PX.Objects.PO.POReceipt,PX.Objects.PO.POReceiptLine,PX.Objects.PO.POReceiptLineSplit].

 

I think this might be appearing because class LineSplittingExtension is defined as abstract. Can anyone advise how I can get access to the ShowSplits method in POReceiptLineSplittingExtension?

Best answer by darylbowman

Try

public class POReceiptLineSplittingExtension_Extension : PXGraphExtension<POReceiptLineSplittingExtension, POReceiptEntry>

 

View original
Did this topic help you find an answer to your question?

2 replies

darylbowman
Captain II
Forum|alt.badge.img+13
  • 1702 replies
  • Answer
  • December 14, 2023

Try

public class POReceiptLineSplittingExtension_Extension : PXGraphExtension<POReceiptLineSplittingExtension, POReceiptEntry>

 


Forum|alt.badge.img+1
  • Author
  • Varsity I
  • 93 replies
  • December 14, 2023

Thanks Daryl, worked first time. 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings