Skip to main content
Question

Stockitem(IN202500) screen Price/cost tab added CurrentCost Filed Not Save in database


Forum|alt.badge.img

How to save currentCost filed in Database ?

This CurrentCost Filed is custom filed

/* DAC */

namespace PX.Objects.IN
{
    public class INItemCostExt : PXCacheExtension<PX.Objects.IN.INItemCost>
    {
        public static bool IsActive() => true;
        #region UsrCurrentCost
        [PXDBPriceCost(BqlField = typeof(INItemCostExt.usrCurrentCost))]
        [PXUIField(DisplayName = "Current Cost")]
        [CurySymbol]
        public virtual Decimal? UsrCurrentCost { get; set; }
        public abstract class usrCurrentCost : PX.Data.BQL.BqlDecimal.Field<usrCurrentCost> { }
        #endregion
    }
}

/* InventoryItemMaint_Extension */ Bussiness Logic
;

namespace PX.Objects.IN
{
    public class InventoryItemMaint_Extension : PXGraphExtension<PX.Objects.IN.InventoryItemMaint>
  {
        public static bool IsActive() => true;
        #region Event Handlers
        protected void INItemCost_RowInserted(PXCache cache, PXRowInsertedEventArgs e, PXRowInserted InvokeBaseHandler)
        {
            if (InvokeBaseHandler != null)
                InvokeBaseHandler(cache, e);
            INItemCost row = (INItemCost)e.Row;
            INItemCostExt itemCostExt = row.GetExtension<INItemCostExt>();
        }

        protected void INItemCost_RowPersisted(PXCache cache, PXRowPersistedEventArgs e, PXRowPersisted InvokeBaseHandler)
        {
            if (InvokeBaseHandler != null)
                InvokeBaseHandler(cache, e);
            INItemCost row = (INItemCost)e.Row;
            INItemCost INItemCost = (INItemCost)Base.ItemCosts.Cache.Current;
            INItemCostExt itemCostExtBase = INItemCost.GetExtension<INItemCostExt>();
        }

        protected void INItemCost_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e, PXRowUpdated InvokeBaseHandler)
        {
            if (InvokeBaseHandler != null)
                InvokeBaseHandler(cache, e);
            INItemCost row = (INItemCost)e.Row;
            INItemCostExt itemCostExt = row.GetExtension<INItemCostExt>();
            INItemCost INItemCost = (INItemCost)Base.ItemCosts.Cache.Current;
            INItemCostExt itemCostExtBase = INItemCost.GetExtension<INItemCostExt>();

        }
        #endregion
    }
}

Thank You..

4 replies

Forum|alt.badge.img
  • Varsity I
  • 27 replies
  • January 8, 2024

Try the RowInserting, RowPersisting, and RowUpdating event handlers.  Those are where you can make changes to the data while it is being saved.

 


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 17 replies
  • January 8, 2024
johnw51 wrote:

Try the RowInserting, RowPersisting, and RowUpdating event handlers.  Those are where you can make changes to the data while it is being saved.

 

There are Event not Working to save Datebase


Forum|alt.badge.img+1
  • Jr Varsity I
  • 62 replies
  • January 11, 2024

Try with PXDatabase.Update.


andriikravetskyi35
Jr Varsity I
Forum|alt.badge.img+1

@Rajginoya 

Try to remove BqlField = typeof(INItemCostExt.usrCurrentCost) from your code, this parameter for PXProjectionAttribute and return null on Set


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings