I am trying to add a dialog box to the SO301000 screen, this dialog box (I think its also considered a smart panel but the difference is lost on me) is just supposed to show a list of orders that a customer has made.
What I have working:
1: I am able to pull all of the orders that a customer has made.
2: I am able to open/close the dialog box after clicking the action.
3: An order IS able to be put into grid.
What doesn't work:
1: I am unable to get more than one order into the grid.
I have no need to edit the orders in this grid, I just want to puke out quick information.
public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
public PXFilter<MSCustomerOrderDac> MSCustomerViewForm;
public PXFilter<MSCustomerOrderDac> MSCustomerOrderViews; //Issue.
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);
int linenumber = 0;
foreach (SOOrder order in orders.Select())
{
MSCustomerOrderDac newOrder = new MSCustomerOrderDac();
newOrder.OrderNumber = order.OrderNbr;
newOrder.LineNbr = linenumber++;
newOrder = MSCustomerOrderViews.Insert(newOrder);
}
if (MSCustomerViewForm.AskExt(true) != WebDialogResult.OK) //need this to show the form
{}
return adapter.Get();
}
[PXVirtual]
[Serializable]
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> { }
}
}
This is the whole of my code, I also tried breaking the loop and adding more than 1 items manually but that made no difference.
I also found this thread on the community forums: https://community.acumatica.com/customizations-187/dialog-with-grid-with-in-memory-dac-from-action-button-8578
However I think he and I were having different issues.
Also, I have just noticed that the order that it is pushing is aways the same one.