Skip to main content
Question

Stock Item Decimal Field Error

  • December 5, 2025
  • 3 replies
  • 23 views

Hello!

I’m looking for some help resolving an error I am seeing with a customization project I created that adds new fields to the Stock Item screen > Packages tab.

The error I am getting is: An error occurred during processing of the field Freight Included: Specified cast is not valid..

Here is what the Trace specifies:

Error: An error occurred during processing of the field UsrFreightIncluded: Unable to cast object of type 'System.Decimal' to type 'System.String'..

Below is part of the code giving me the issue. 

public class InventoryItemExt : PXCacheExtension<InventoryItem>

{

    #region UsrFreightIncluded
    [PXDBDecimal(2)]
    [PXDefault(TypeCode.Decimal,"0.00")]
    [PXUIField(DisplayName = "Freight Included")]
    public virtual string UsrFreightIncluded { get; set; }
    public abstract class usrFreightIncluded : PX.Data.BQL.BqlDecimal.Field<usrFreightIncluded> { }
    #endregion
}

 

Thanks in advance!

3 replies

Forum|alt.badge.img+7
  • Captain II
  • December 5, 2025

The issue is in your declaration:

  public virtual string UsrFreightIncluded { get; set; }

You’ll want that to be:

  public virtual Decimal? UsrFreightIncluded { get; set; }


Thanks for that! However this gave me a new error:

Error: The entry form (ID: IN202500, title: Stock Items) cannot be automated. An error occurred during processing of the field Freight Included: Specified cast is not valid..

Any thoughts on this one?


jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • December 6, 2025

Hi ​@FreddyDelRio96 

Please verify that the field was created as a Decimal in the database. It appears that the field may have been created as a string, which is causing the error.

The DAC field should be defined as follows:

#region UsrFreightIncluded
[PXDBDecimal(2)]
[PXDefault(TypeCode.Decimal, "0.00")]
[PXUIField(DisplayName = "Freight Included")]
public virtual decimal? UsrFreightIncluded { get; set; }
public abstract class usrFreightIncluded : PX.Data.BQL.BqlDecimal.Field<usrFreightIncluded> { }
#endregion