I have created a second PXSelector that mimicks the behavior of the out-of-the-box UOM field in the Sales Order entry screen. I have detailed the process of creating this below; I have basically copied all the elements I can find from the existing UOM field (and renamed to jUOM as necessary). Everything works, except I get an error when saving the Sales Order document that says “Invalid column name ‘jUOM’.
I am stuck trying to figure out how to create an extended field on the SOLine cache that can save the value chosen by the user for this second UOM field (called jUOM) to a field in the database.
I confess to not really understanding how the out-of-the-box UOM field is being saved to the SOLine database table, which is part of my problem. I have played around with using PXDBString etc, but that breaks the UOM selector (can’t be used with the: INUnit(typeof(SOLine.inventoryID), DisplayName = "jUOM")] DAC field declaration).
Can someone help me makes sense of what’s going on with these UOM selectors and how to save them to a custom field in the database?
Â
Details on creating second UOM field for Sales Order entry screen (Transactions section - line level Sales Order lines):
I extended the SOLine DAC, and added basically the same code for UOM that is found in the SOLine class (I called my UOM field jUOM...see code below.)
I had issues in the past with the correct values showing up for whatever item had been selected for the current Sales Order line. The solution to that problem was copying this piece of code from the ASPX page. The PXControlParam portion of the PXSelector appears to restrict the UOM values to those that are attached to the item with InventoryID selected for that Sales Order line.
Â
<px:PXSelector CommitChanges="True" ID="edjUOM" runat="server" DataField="jUOM" AutoRefresh="True">
<Parameters>
   <px:PXControlParam ControlID="grid" Name="SOLine.inventoryID" PropertyName="DataValuese"InventoryID"]" Type="String" ></px:PXControlParam>
</Parameters>
</px:PXSelector>
Â
   public class SOLineExt : PXCacheExtension<SOLine>
   {
     Â
      #region jUOM
      public abstract class juOM : PX.Data.BQL.BqlString.Field<juOM> { }
      protected String _jUOM;
      ÂINUnit(typeof(SOLine.inventoryID), DisplayName = "jUOM")]
      SPXDefault(typeof(Search<InventoryItem.salesUnit, Where<InventoryItem.inventoryID, Equal<Current<SOLine.inventoryID>>>>), PersistingCheck = PXPersistingCheck.Nothing)]
      public virtual String jUOM
      {
         get
         {
            return this._jUOM;
         }
         set
         {
            this._jUOM = value;
         }
         #endregion
      }
   }
Â