Skip to main content
Question

Stock Item Decimal Field Error

  • December 5, 2025
  • 2 replies
  • 15 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!

2 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?