Hello colleagues,
I am implementing event handler for StockItem to force User must enter value for selector Weight UOM. The field Weight UOM doesn’t have red red icon on the left of label
![](https://uploads-us-west-2.insided.com/acumatica-en/attachment/1524134c-1356-46de-8e9c-44050fd606c7.png)
using the following code:
protected void InventoryItem_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
{
var row = (InventoryItem)e.Row;
if (row == null) return;
if (e.Operation == PXDBOperation.Insert)
{
if (string.IsNullOrEmpty(row.WeightUOM))
{
var fieldDisplayName = PXUIFieldAttribute.GetDisplayName<InventoryItem.weightUOM>(cache);
var localizedErrorMessage = PXMessages.LocalizeFormat("Field {0} can't be empty", fieldDisplayName);
PXUIFieldAttribute.SetError<InventoryItem.weightUOM>(cache, row, null);
cache.RaiseExceptionHandling<InventoryItem.weightUOM>(e.Row, row.WeightUOM, new PXSetPropertyException(localizedErrorMessage, PXErrorLevel.Error));
}
}
}
I used the same code for field Weight (type: decimal?) and it works fine
![](https://uploads-us-west-2.insided.com/acumatica-en/attachment/c7f50095-3cd8-453d-8667-1c6945522e9b.png)
Do you have any idea?