Skip to main content
Answer

How to modify the ItemInfo view on "Add Items" button of the Sales Order form?

  • November 11, 2025
  • 6 replies
  • 74 views

Forum|alt.badge.img

Hello Community, 

 

I am working to try and modify the ItemInfo view on the “Add Items” button of the sales order screen and running into some trouble and hoping someone can point me in the right direction. I understand I needed to extend the graph “PXGraphExtension<SOOrderSiteStatusLookupExt, SOOrderEntry>” but the ItemInfo view seems much different to modify vs other views in various forms. The goal is to limit what items can show up in the view based on some criteria entered in the sales order header. Is it possible to say, only show items where in another view? Maybe I just need to rebuild the ItemInfo view in the initialize of the graph extension? Is that possible? 

Thanks,

Adam

Best answer by darylbowman

I missed that you added PXAdapter to your delegate. It should look like this instead:

public delegate IEnumerable ItemInfoDelegate();
[PXOverride]
public virtual IEnumerable itemInfo(ItemInfoDelegate baseMethod)
{
return baseMethod();
}

 

6 replies

Forum|alt.badge.img+3

Have you tried resolving your issue using a Data View Delegate as shown below?

public class SOOrderSiteStatusLookupMyExt : PXGraphExtension<SOOrderSiteStatusLookupExt, SOOrderEntry>
{
public virtual IEnumerable itemInfo()
{
var myItems = // define your items;

foreach (var item in myItems)
{
yield return item;
}
}
}

 


darylbowman
Captain II
Forum|alt.badge.img+15

There’s actually already a data view delegate in AddItemLookupBaseExt which is what SOOrderSiteStatusLookupExt is based on:

You could try extending / overriding this method.

 

Alternatively, you could override CreateItemInfoView() to return your own version of CreateWhere():

 


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • November 11, 2025

Thank you both! I think I am getting close as overwriting the itemInfo() method allowed me to blank the item results by doing so. Is it possible that unless its a specific order type I can call the base method instead? I tried below but the adapter is null and just errors out on me. How can I call the base itemInfo() if it's not the order type I want to have the new data? Trying to avoid adding an entirely new button. 

        public delegate IEnumerable ItemInfoDelegate(PXAdapter adapter);
public virtual IEnumerable itemInfo(PXAdapter adapter, ItemInfoDelegate baseMethod)
{
PXTrace.WriteInformation("itemInfo called");
SOOrder order = Base.Document.Current;
PXTrace.WriteInformation(order.CustomerID.ToString());
if (order != null)
{
PXTrace.WriteInformation(order.OrderType);
SOOrderExt orderExt = order.GetExtension<SOOrderExt>();

PXTrace.WriteInformation(InstallType.INSTALLTYPE);
if (String.Equals(order.OrderType, InstallType.INSTALLTYPE, StringComparison.OrdinalIgnoreCase)
&& !(String.IsNullOrWhiteSpace(orderExt.UsrModel)
|| String.IsNullOrWhiteSpace(orderExt.UsrMake)
|| String.IsNullOrWhiteSpace(orderExt.UsrYear)))
{
var items = PXSelectJoin<InventoryItem,
InnerJoin<InventoryInstalls,
On<InventoryItem.inventoryCD, Equal<InventoryInstalls.inventoryID>>>,
Where<InventoryInstalls.model, Equal<Required<SOOrderExt.usrModel>>,
And<InventoryInstalls.year, Equal<Required<SOOrderExt.usrYear>>,
And<InventoryInstalls.make, Equal<Required<SOOrderExt.usrMake>>>>>>
.Select(new PXGraph(), orderExt.UsrModel, orderExt.UsrYear, orderExt.UsrMake);

foreach (PXResult<InventoryItem, InventoryInstalls> rec in items)
{
yield return rec;
}
}
else
{
baseMethod(adapter);
}
}

}

Thanks!


darylbowman
Captain II
Forum|alt.badge.img+15

You need to return the result of the baseMethod since your return type is IEnumerable:

return baseMethod(adapter);

Also, you need to add the [PXOverride] attribute above your overridden method. At this point, it is probably creating a new data view delegate.


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • November 12, 2025

Thanks ​@darylbowman and ​@aleksandrsechin for the help thus far! With the PXOverride, I get the following error:

The System.Collections.IEnumerable itemInfo(PX.Data.PXAdapter, ItemInfoDelegate) method in the PX.Objects.SO.GraphExtensions.SOOrderEntryExt.SOOrderGraphExt graph extension is marked as [PXOverride], but its signature is not compatible with the original method.

 

I figured this was because the original method didn't have any actual parameters, so I tested without the additional parameters, and it no longer gave me that error. But I needed something to return so I am currently just returning an empty PXDelegateResult to avoid error during the test. 

public delegate IEnumerable ItemInfoDelegate(PXAdapter adapter);
[PXOverride]
//public virtual IEnumerable itemInfo(PXAdapter adapter, ItemInfoDelegate baseMethod)
public virtual IEnumerable itemInfo()
{
PXTrace.WriteInformation("itemInfo called");
var rows = new PXDelegateResult();

return rows;
}

Is there something in Base1 that I should be setting the delegate to, so it just does default behavior if a condition isn't met? 

Additionally, I’ve followed the trail back and see that TItemInfo parameter is used in the AddItemLookupBaseExt and is pulling from SOOrderSiteStatusSelected DAC. Can I just create a similar view pulling from the same table with additional conditions and overwrite ItemInfo view when orderType is changed? 

I will see if I can override the “CreateWhere()” as Daryl mentioned also. But I think I would run into the issue of not begin able to call the original method if my condition isn't met also. So, think I am just missing a piece here. 

Thanks!


darylbowman
Captain II
Forum|alt.badge.img+15
  • Answer
  • November 12, 2025

I missed that you added PXAdapter to your delegate. It should look like this instead:

public delegate IEnumerable ItemInfoDelegate();
[PXOverride]
public virtual IEnumerable itemInfo(ItemInfoDelegate baseMethod)
{
return baseMethod();
}