Solved

Automatically pop up the Related Items screen

  • 28 July 2023
  • 2 replies
  • 47 views

Userlevel 2

We have a customer that has requested that the Related Items screen automatically open in the Sales Order screen if a user enters an inventory id that has related items to choose from.  Our developer has looked into this.  He was able to get the related items screen to automatically open but the changes that the dialog is supposed to apply are lost somehow because we are doing this in the middle of the row update.

Has anyone been able to achieve this or have any advice?

icon

Best answer by jinin 31 July 2023, 20:40

View original

2 replies

Userlevel 7
Badge +11

Hi 

I assume that you added a popup when clicking on the inventoryID, In the popup Add a Button as Add or OK (Refer to the screenshot). In the Add/OK button, Add the code to insert the related item load on the Soline.
 


Sample Code for the OK/Add button:

public PXAction<SOOrder> RelatedProductsOK;
        [PXButton]
        [PXUIField(DisplayName = "Related Items")]
        protected virtual void relatedProductsOK()
        {         
          InventoryItemFilter.AskExt();

            if (InventoryItemFilter.Cache.Inserted.Cast<InventoryItemFilter>().Count() > 0)
            {
                if (InventoryItemFilter.AskExt() == WebDialogResult.OK)
                {
                    foreach (InventoryItemFilter invt in InventoryItemFilter.Cache.Inserted)
                    {
                          if (invt.Selected==true)
                        {
                            SOLine newline = PXCache<SOLine>.CreateCopy(Base.Transactions.Insert(new SOLine()));
                            newline.InventoryID = invt.InventoryID;
                            newline.OrderQty = 1;
                            newline.SiteID = invt.DfltSiteID;
                            Base.Transactions.Cache.Update(newline);

                            InventoryItemFilter.Cache.SetValueExt<InventoryItemFilter.selected>(invt, false);
                        }
                    }
                }
            } 

Userlevel 2

Thanks for the information.  Our developer had to do some additional work because the Related Items pop up screen was a little more complicated, but he was able to get it working.

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