Question

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

  • 8 January 2024
  • 4 replies
  • 59 views

Userlevel 1
Badge

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

Userlevel 2
Badge

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

 

Userlevel 1
Badge

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

Try with PXDatabase.Update.

Userlevel 5
Badge +1

@Rajginoya 

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

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved