I have a grid where I have sales orders and service orders in the same field. I want to make this a hyperlink, so I used the callback command and a custom redirect action. That works and redirects properly, but it pulls the data from the first row instead of the one currently selected. I’ve tried the SyncPosition = true and making sure the dac has a key field, but to no avail. Would anyone be able to help me out? Thanks.
<CallbackCommands>
<px:PXDSCallbackCommand CommitChanges="True" Name="ViewDocument" Visible="False" DependOnGrid="Details" ></px:PXDSCallbackCommand></CallbackCommands>
.
.
.
.
.
<px:PXTabItem Text="Details">
<Template>
<px:PXGrid SyncPosition="True" Height="100%" Width="100%" AutoAdjustColumns="True" runat="server" ID="Details" SkinID="Inquire" AllowPaging="False">
<Levels>
<px:PXGridLevel DataMember="Details">
<Columns>
<px:PXGridColumn DataField="InventoryID" Width="70" ></px:PXGridColumn>
<px:PXGridColumn DataField="DocType" Width="70" ></px:PXGridColumn>
<px:PXGridColumn LinkCommand="ViewDocument" DataField="OrderNbr" Width="70" ></px:PXGridColumn>
.
.
.public PXAction<InventoryDiscrepenciesFilter> ViewDocument;
[PXButton]
[PXUIField(DisplayName = "ViewDocument", MapEnableRights = PXCacheRights.Select)]
protected virtual void viewDocument()
{
InventoryDiscrepenciesDetails row = Details.Current;
SOOrder salesOrder = PXSelect<SOOrder, Where<SOOrder.orderType, Equal<Required<InventoryDiscrepenciesDetails.orderType>>,
And<SOOrder.orderNbr, Equal<Required<InventoryDiscrepenciesDetails.orderNbr>>>>>.Select(this, row?.OrderType, row?.OrderNbr);
FSServiceOrder srvOrder = PXSelect<FSServiceOrder, Where<FSServiceOrder.srvOrdType, Equal<Required<InventoryDiscrepenciesDetails.orderType>>,
And<FSServiceOrder.refNbr, Equal<Required<InventoryDiscrepenciesDetails.orderNbr>>>>>.Select(this, row?.OrderType, row?.OrderNbr);
if (salesOrder != null)
{
SOOrderEntry graph = PXGraph.CreateInstance<SOOrderEntry>();
graph.Document.Current = salesOrder;
if (graph.Document.Current != null)
{
throw new PXRedirectRequiredException(graph, true, "Sales Orders")
{
Mode = PXBaseRedirectException.WindowMode.NewWindow
};
}
}
else if (srvOrder != null)
{
ServiceOrderEntry graph = PXGraph.CreateInstance<ServiceOrderEntry>();
graph.ServiceOrderRecords.Current = srvOrder;
if (graph.ServiceOrderRecords != null)
{
throw new PXRedirectRequiredException(graph, true, "Service Orders")
{
Mode = PXBaseRedirectException.WindowMode.NewWindow
};
}
}
return;
}public PXFilter<InventoryDiscrepenciesFilter> Filter;
public PXFilter<InventoryDiscrepenciesDetails> Details;