Skip to main content
Answer

Overriding method in framework graph abstract class

  • May 9, 2025
  • 2 replies
  • 76 views

Tony Lanzer
Pro III
Forum|alt.badge.img+2

Is it possible to override a method in a framework graph abstract class?  I am attempting to override a method in the 24R2 Sales Order entry screen for the Add button on the dialog that opens when the Add Items button on the Details tab is selected -- Inventory Lookup. The method is PX.Objects.Extensions.AddItemLookup.AddItemLookupBaseExt<TGraph,TDocument,TItemInfo,TItemFilter>.AddSelectedItems(). I have tried extending it like this including the full class hierarchy:

public class KRSOOrderEntry_Extension : 
PXGraphExtension<AddItemLookupBaseExt<SOOrderEntry, SOOrder, SOOrderSiteStatusSelected, SOSiteStatusFilter>,
SiteStatusLookupExt<SOOrderEntry,SOOrder, SOLine, SOOrderSiteStatusSelected, SOSiteStatusFilter>,
AlternateIDLookupExt<SOOrderEntry, SOOrder, SOLine, SOOrderSiteStatusSelected, SOSiteStatusFilter, SOOrderSiteStatusSelected.salesUnit>,
SOOrderSiteStatusLookupExt,
SOOrderEntry>

and I receive a runtime error:

“Graph extension KRSOAddItemLocation.KRSOOrderEntry_Extension cannot refer to the following abstract graph extensions that are not marked as [PXProtectedAccess]: PX.Objects.Extensions.AddItemLookup.AddItemLookupBaseExt`4[PX.Objects.SO.SOOrderEntry,PX.Objects.SO.SOOrder,PX.Objects.SO.SOOrderSiteStatusSelected,PX.Objects.SO.SOSiteStatusFilter], PX.Objects.Extensions.AddItemLookup.SiteStatusLookupExt`5[PX.Objects.SO.SOOrderEntry,PX.Objects.SO.SOOrder,PX.Objects.SO.SOLine,PX.Objects.SO.SOOrderSiteStatusSelected,PX.Objects.SO.SOSiteStatusFilter], PX.Objects.Extensions.AddItemLookup.AlternateIDLookupExt`6[PX.Objects.SO.SOOrderEntry,PX.Objects.SO.SOOrder,PX.Objects.SO.SOLine,PX.Objects.SO.SOOrderSiteStatusSelected,PX.Objects.SO.SOSiteStatusFilter,PX.Objects.SO.SOOrderSiteStatusSelected+salesUnit].”

Best answer by svwk05

Hello ​@Tony Lanzer 

Can you try the following code

public class SOOrderGraphExt : PXGraphExtension<SOOrderSiteStatusLookupExt, SOOrderEntry>
{
public static bool IsActive() => true;

[PXOverride]
public virtual IEnumerable ShowItemsHandler(PXAdapter adapter)

{
//Custom logic
return adapter.Get();

}
}

Hope this helps!!!

2 replies

Forum|alt.badge.img+1
  • Semi-Pro III
  • Answer
  • May 9, 2025

Hello ​@Tony Lanzer 

Can you try the following code

public class SOOrderGraphExt : PXGraphExtension<SOOrderSiteStatusLookupExt, SOOrderEntry>
{
public static bool IsActive() => true;

[PXOverride]
public virtual IEnumerable ShowItemsHandler(PXAdapter adapter)

{
//Custom logic
return adapter.Get();

}
}

Hope this helps!!!


Tony Lanzer
Pro III
Forum|alt.badge.img+2
  • Author
  • Pro III
  • May 9, 2025

I got this working by removing the abstract classes from the hierarchy, you’re right ​@Saikrishna V, thank you, and I’ll mark your response as the answer. Shout out to ​@darylbowman in this post I found that first led me to a resolution: 

public class KRSOOrderEntry_Extension : PXGraphExtension<
SOOrderSiteStatusLookupExt,
SOOrderEntry>