Skip to main content
Answer

How to make sure a clickable OrderNbr doesn't always open the first order int the grid.

  • January 14, 2025
  • 2 replies
  • 36 views

Forum|alt.badge.img+1

I have a new processing screen set up with a column for OrderNbr.  The view is created from: 

public SelectFrom<SOOrder>
.LeftJoin<Note>.On<SOOrder.noteID.IsEqual<Note.noteID>>
.Where<
SOOrder.orderType.IsEqual<wOOrderType>
.And<SOOrder.shipVia.IsNotLike<intlShipVia>>
.And<SOOrder.shipVia.IsNotLike<dropShipStart>>
.And<SOOrder.status.IsEqual<SOOrderStatus.open>>
.And<SOOrder.ownerID.IsNull>
.And<Note.noteID.IsNull
.Or<Note.noteText.IsNull>
.Or<Note.noteText.IsEqual<Empty>>
.Or<Note.noteText.IsLike<signatureWaived>>>
.And<SOOrder.curyOrderTotal.IsLessEqual<orderTotalMaxSpend>>
.And<
SOOrder.paymentMethodID.IsIn<
paymentMethodAFFIRM,
paymentMethodPAYPAL,
paymentMethodAFTERPAY,
paymentMethodCCARD>
>
>
.ProcessingView AISOOrder;

I have added an action as: 

public PXAction<SOOrder> ViewDocument;
[PXButton]
[PXUIField(DisplayName = "View Order", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
public virtual void viewDocument()
{
var order = AISOOrder.Cache.Current as SOOrder;

PXTrace.WriteInformation($"Selected OrderNbr: {AISOOrder.Current?.OrderNbr}, OrderType: {AISOOrder.Current?.OrderType}");

if (order?.OrderNbr != null)
{
SOOrderEntry docGraph = PXGraph.CreateInstance<SOOrderEntry>();
docGraph.Document.Current = PXSelect<SOOrder,
Where<SOOrder.orderNbr, Equal<Required<SOOrder.orderNbr>>,
And<SOOrder.orderType, Equal<Required<SOOrder.orderType>>>>>
.Select(this, order.OrderNbr, order.OrderType);

if (docGraph.Document.Current != null)
{
PXRedirectHelper.TryRedirect(docGraph, PXRedirectHelper.WindowMode.NewWindow);
}
}
}

The problem I have is that whichever OrderNbr I click on in the grid it always opens a new window for the first order in the grid unless I have previously clicked the Selected field.

Am I missing something really obvious that would enable the current row to be selected one?

 

I can provide the customization file if that would help.  I’m really tearing out my hair on this one.

 

Thanks for any and all help,

Phil

Best answer by darylbowman

Do you have SyncPosition = true set on your grid? Not positive this will help, but it’s worth a try.

2 replies

darylbowman
Captain II
Forum|alt.badge.img+15
  • Answer
  • January 14, 2025

Do you have SyncPosition = true set on your grid? Not positive this will help, but it’s worth a try.


Forum|alt.badge.img+1
  • Author
  • Semi-Pro I
  • January 14, 2025

@darylbowman That was it!

Thank you so much.

Phil