Solved

Hoiw do I make OrderNbr and ShipmentNbr clickable links to the relevant screen in AR301000?

  • 22 July 2022
  • 7 replies
  • 289 views

Userlevel 5
Badge +1

I have added the Order and Shipment Number fields to the Details grid in a customization but would like them to navigate to their respective screens when clicked.  This seems like a really simple thing but I haven’t been able to work out how or where this is defined. This is already present in SO303000 and I’ve been comparing to see what the difference is but am not sure where I should be looking. Can anyone give me some pointers as to how to go about this?

 

Thanks,

 

Phil

icon

Best answer by jinin 22 July 2022, 21:09

View original

7 replies

Userlevel 7
Badge +11

Hi @ppowell 

You need to create an action to redirect the screen. And also needs to link the action on the aspx grid field level.

I’ve added a sample code here. Please review. 

 

    public PXAction<PrimaryDacName> viewDocument;
        [PXButton]
        public virtual void ViewDocument()
        {
            if (ViewName.Current?.OrderNbr != null)
            {
                SOOrderEntry docgraph = CreateInstance<SOOrderEntry>();
                docgraph.Document.Current =PXSelectReadonly<SOOrder,Where<SOOrder.orderNbr,Equal<Required<SOOrder.orderNbr>>,And<SOOrder.behavior,Equal<Required<SOOrder.behavior>>>>>.Select(this, ViewName.Current.OrderNbr,SOOrderTypeConstants.SalesOrder);
                if (docgraph.Document.Current != null)
                    PXRedirectHelper.TryRedirect(docgraph, PXRedirectHelper.WindowMode.NewWindow);
            }
        }


        public PXAction<PrimaryDacName> viewShipment;
        [PXButton]
        public virtual void ViewShipment()
        {
            if (ViewName.Current?.ShipmentNbr != null)
            {
                SOShipmentEntry docgraph = CreateInstance<SOShipmentEntry>();
                docgraph.Document.Current = docgraph.Document.Search<SOShipment.shipmentNbr>(ViewName.Current.ShipmentNbr);
                if (docgraph.Document.Current != null)
                    PXRedirectHelper.TryRedirect(docgraph, PXRedirectHelper.WindowMode.NewWindow);
            }
        }

 

<px:PXGridColumn DataField="orderNbr" LinkCommand="ViewDocument"></px:PXGridColumn>

<px:PXGridColumn DataField="shipmentNbr" LinkCommand="ViewShipment"></px:PXGridColumn>

 

 

Userlevel 5
Badge +1

@jinin Thanks for the help but I can’t get it to work.  Is this supposed to go in the ARInvoiceEntry Extension?  For Primary DAC I presume I should put PX.Objects.AR.ARInvoice as that is the primary DAC for the screen (I believe).

But I get the following errors:

\App_RuntimeCode\ARInvoiceEntry.cs(74): error CS0103: The name 'OrderDeckDetails' does not exist in the current context

\App_RuntimeCode\ARInvoiceEntry.cs(77): error CS0103: The name 'OrderDeckDetails' does not exist in the current context

\App_RuntimeCode\ARInvoiceEntry.cs(88): error CS0103: The name 'OrderDeckDetails' does not exist in the current context

\App_RuntimeCode\ARInvoiceEntry.cs(90): error CS0103: The name 'CreateInstance' does not exist in the current context

\App_RuntimeCode\ARInvoiceEntry.cs(91): error CS0103: The name 'OrderDeckDetails' does not exist in the current context

\App_RuntimeCode\ARInvoiceEntry.cs(74): error CS0103: The name 'OrderDeckDetails' does not exist in the current context

Compiler time, in seconds: 4.0110569

 

I think I’m misunderstanding something.

 

Phil

Userlevel 7
Badge +11

Hi @ppowell 

Please use the grid view name of the graph. I’ve provided the sample code for your reference. 
You are right, if you are using ARInvoiceEntry extension, the primary DAC is ARInvoice. 

 

 public PXAction<PrimaryDacName> viewDocument;
        [PXButton]
        public virtual void ViewDocument()
        {
            if (GridViewName.Current?.OrderNbr != null)
            {
                SOOrderEntry docgraph = CreateInstance<SOOrderEntry>();
                docgraph.Document.Current = PXSelectReadonly<SOOrder, Where<SOOrder.orderNbr, Equal<Required<SOOrder.orderNbr>>, And<SOOrder.behavior, Equal<Required<SOOrder.behavior>>>>>.Select(this, GridViewName.Current.OrderNbr, SOOrderTypeConstants.SalesOrder);
                if (docgraph.Document.Current != null)
                    PXRedirectHelper.TryRedirect(docgraph, PXRedirectHelper.WindowMode.NewWindow);
            }
        }

        public PXAction<PrimaryDacName> viewShipment;
        [PXButton]
        public virtual void ViewShipment()
        {
            if (GridViewName.Current?.ShipmentNbr != null)
            {
                SOShipmentEntry docgraph = CreateInstance<SOShipmentEntry>();
                docgraph.Document.Current = docgraph.Document.Search<SOShipment.shipmentNbr>(GridViewName.Current.ShipmentNbr);
                if (docgraph.Document.Current != null)
                    PXRedirectHelper.TryRedirect(docgraph, PXRedirectHelper.WindowMode.NewWindow);
            }
        }

Userlevel 5
Badge +1

@jinin Thanks for the further info.  I suspected it was something like that.  I feel like I’m being incredibly stupid but I can’t seem to get it to work.  Where do I find the GridViewName? I had a look at the screen definitions and the Grid seems to be called Transactions but that doesn’t work so I presume I’m missing something or looking in the wrong place.

 

Sorry, and thanks for all your help.

 

Phil

Userlevel 7
Badge +11

Hi @ppowell 
Can you please share with me the screenshot where you are trying to add the Navigation?

Userlevel 5
Badge +1

@jinin Thanks for your help, I really appreciate it.  The screen where I have added the fields is below. I just need to make them open the relevant screens:

I already had an extension to ARInvoiceEntry as I am renaming the Description field to Notes on the screen so I have been trying to add the PXActions in there but I think I’m doing something wrong.

 

Thanks,

 

Phil

 

Userlevel 5
Badge +1

@jinin Thanks so much for all your help.  I found the name of the view I needed finally. The following is what I have now and seems to be working OK:

 

public PXAction<PX.Objects.AR.ARInvoice> viewDocument;
[PXButton]
public virtual void ViewDocument()
{
if (Base.AllTransactions.Current?.SOOrderNbr != null)
{
SOOrderEntry docgraph = PXGraph.CreateInstance<SOOrderEntry>();
docgraph.Document.Current =
PXSelectReadonly<SOOrder,
Where<SOOrder.orderNbr,Equal<Required<SOOrder.orderNbr>>,
And<SOOrder.behavior,Equal<Required<SOOrder.behavior>>
>
>
>.Select(this.Base, Base.AllTransactions.Current.SOOrderNbr,SOOrderTypeConstants.SalesOrder);
if (docgraph.Document.Current != null)
PXRedirectHelper.TryRedirect(docgraph, PXRedirectHelper.WindowMode.NewWindow);
}
}


public PXAction<PX.Objects.AR.ARInvoice> viewShipment;
[PXButton]
public virtual void ViewShipment()
{
if (Base.AllTransactions.Current?.SOShipmentNbr != null)
{
SOShipmentEntry docgraph = PXGraph.CreateInstance<SOShipmentEntry>();
docgraph.Document.Current = docgraph.Document.Search<SOShipment.shipmentNbr>(Base.AllTransactions.Current.SOShipmentNbr);
if (docgraph.Document.Current != null)
PXRedirectHelper.TryRedirect(docgraph, PXRedirectHelper.WindowMode.NewWindow);
}
}

The missing piece of the puzzle was the view name being AllTransactions and not Transactions.  Also I had to change this to this.Base for it work.  

After I finally got it to validate I added the LinkCommand settings in the form and it worked.

I really appreciate the time you put in to help me find a solution to my problem.

Phil

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved