Skip to main content

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&quot;]" 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
        }

    }

 

Hi @rosenjon  I just checked it and DAC field is wrong. It seems for the existing field simply you have added j before UOM field. DAC field declaration incorrect.

   public class SOLineExt : PXCacheExtension<PX.Objects.SO.SOLine>
{
#region JUOM

PXUIField(DisplayName = "jUOM")]
INUnit(typeof(SOLine.inventoryID), DisplayName = "jUOM")]
PXDefault(typeof(Search<InventoryItem.salesUnit, Where<InventoryItem.inventoryID, Equal<Current<SOLine.inventoryID>>>>), PersistingCheck = PXPersistingCheck.Nothing)]
public virtual string JUOM { get; set; }
public abstract class jUOM : PX.Data.BQL.BqlString.Field<jUOM> { }

#endregion
}

 

 


Hi Naveen-

Not really…. I’m trying to create a second UOM selector tied to a new database field that will record the data in that second UOM selector. This must be tracked independent of the existing UOM field.

I added the additional field to the aspx psge as I described. I also added it to the UI and it appears and works correctly, except for the save issue.

I am asking how to fix my issue with persisting the data on save. I realize my DAC declaration may be incorrect (I am posting because I’m getting an error on save). The question is how do I fix it? 


Hi @rosenjon  If you see my screenshot above, I can able to SAVE the Sales Order Document successfully.

Have you created the new field (jUOM) in the Database?


Hi @rosenjon  I have created the new customization package by adding the new UOM field (JUOM).

Please publish this package and verify.

 


Thanks Naveen, it just required adding the database column and it worked perfect!

This was really just a limitation in my knowledge of Acumatica. I haven’t had much experience adding new columns to tables. I’ve mostly done it through the Customization Project UI in the past and they always had the usrXXX format to the names, so I thought maybe that was required.

I was actually reviewing a previous post of yours where you had helped someone else with a similar issue when you replied to this post...

 

It seems (per your instructions) that you can create new fields in the database itself and then synch them from the customization project, which is awesome. Way easier than trying to do it through the Acumatica GUI.

Thanks for your help and quick replies!


@rosenjon  Awesome. I’m glad that I helped you on this!


Reply