Skip to main content
Solved

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


Forum|alt.badge.img+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

Best answer by jinin

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);
            }
        }

View original
Did this topic help you find an answer to your question?

7 replies

jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • 699 replies
  • July 22, 2022

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>

 

 


Forum|alt.badge.img+1
  • Author
  • Semi-Pro I
  • 134 replies
  • July 22, 2022

@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


jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • 699 replies
  • Answer
  • July 22, 2022

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);
            }
        }


Forum|alt.badge.img+1
  • Author
  • Semi-Pro I
  • 134 replies
  • July 23, 2022

@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


jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • 699 replies
  • July 25, 2022

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


Forum|alt.badge.img+1
  • Author
  • Semi-Pro I
  • 134 replies
  • July 25, 2022

@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

 


Forum|alt.badge.img+1
  • Author
  • Semi-Pro I
  • 134 replies
  • July 26, 2022

@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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings