Hello, I am currently trying to add a smart panel that just shows other orders a customer has placed. I used this vlog as a guide: https://www.acumatica.com/blog/vlog-changing-an-acumatica-po-number-with-a-smart-panel-and-custom-action/
It got me most of the way there. Currently I have the dialog box popping up and I am able to close it. In the code I can see that I am pulling all orders that a customer has made. However, the grid in the dialog box only shows one item in it and I am not exactly sure why that would be. I thought it might be related to this other forum post:
But since I am seeing something in my grid, I think I am making a different mistake.
namespace PX.Objects.SO {
// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
public PXFilter<MSCustomerOrderDac> MSCustomerViewForm; //This is used as the key for the dialog box
public PXFilter<MSCustomerOrderDac> MSCustomerOrderViews; //This is used as teh key for the grid
public PXAction<SOOrder> ViewCustomerOrders;
[PXUIField(DisplayName = "View Custoemr", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
[PXButton(Category = "Other")]
[PXUIEnabled(typeof(Where<SOOrder.customerID.IsNotNull>))]
protected virtual IEnumerable viewCustomerOrders(PXAdapter adapter)
{
MSCustomerOrderViews.AllowInsert=true;
PXSelectBase<SOOrder> orders =
new PXSelectReadonly<SOOrder,
Where<SOOrder.customerID, Equal<Current<SOOrder.customerID>>>>(Base);
foreach (SOOrder order in orders.Select())
{
MSCustomerOrderDac newOrder = new MSCustomerOrderDac();
newOrder.OrderNumber = order.OrderNbr;
newOrder.LineNbr = linenumber++;
newOrder = MSCustomerOrderViews.Insert(newOrder);
} //only inserts one thing, no good/
if (MSCustomerViewForm.AskExt(true) != WebDialogResult.OK) //need this to show the form
{
}
return adapter.Get();
}
// I might need to add a
[PXVirtual]
[Serializable]
[PXHidden]
public class MSCustomerOrderDac : IBqlTable
{
#region OrderNumber
[PXString]
[PXUIField(DisplayName = "Order Number")]
public virtual String OrderNumber { get; set; }
public abstract class orderNumber : PX.Data.BQL.BqlString.Field<orderNumber> { }
#endregion
[PXInt(IsKey = true)]
public virtual Int32? LineNbr { get; set; }
public abstract class lineNbr : PX.Data.BQL.BqlInt.Field<lineNbr> { }
}
}
For the dialog box I haven’t done anything crazy, just defined the keys/skinid/ds/ and created controls for the orderNumber field.
Thanks in advance.