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?
Page 1 / 1
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);             }           }         }       }Â
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.