Loading ...

How To Add Redirect To Grid In Acumatica

Hello everybody,

today I want to write a few words on how to add links to some entites in Acumatica.

So, recently I've had an assignment to add redirect into existing grid, so intead of showing some text show nice link which will lead to Purchase order.

Here is what I've done in order to achieve it.

First of all I've noticed, what is primary DAC class in graph. It was VendFilt. 

Then following steps were needed:

  1. create code for button:

Snippet

public PXAction<VendFilt> gotoPOOrder;
 
[PXButton(Tooltip = "Open Purchase order")]
[PXUIField(DisplayName = "Open PO")]
public virtual void GotoPOOrder()
{
    var poOrdEntryGraph = PXGraph.CreateInstance<POOrderEntry>();
    var currentPoPorder = VendorOrders.Current;
 
    poOrdEntryGraph.Document.Current = poOrdEntryGraph.Document.Search<POOrder.orderNbr>(currentPoPorder.OrderNbr);
 
    if (poOrdEntryGraph.Document.Current != null)
    {
        throw new PXRedirectRequiredException(poOrdEntryGraph, true"Purchase order Details");
    }
 
}

 

2.  Modify PXDataSource:

Snippet

    <px:PXDataSource ID="ds" runat="server" Visible="True" TypeName="Acumatica.PaymentsAllocation" 
        PrimaryView="VendorFilter" SuspendUnloading="False">
        <CallbackCommands>
            <px:PXDSCallbackCommand Name="GotoPOOrder" Visible="False" DependOnGrid="grdAllocation">
            </px:PXDSCallbackCommand>
         </CallbackCommands>
	</px:PXDataSource>

 

3. Modify grid column like this:

Snippet

<px:PXGridColumn DataField="OrderNbr" LinkCommand="GotoPOOrder"></px:PXGridColumn>

 

And as result I've got nice link which lead to needed po order