This document describes the PX1044 diagnostic.
| Code | Short Description | Type | Code Fix |
|---|---|---|---|
| PX1044 | Changes to PXCache cannot be performed in event handlers. |
Error | Unavailable |
The Insert, Update, and Delete methods cannot be invoked on any PXCache object in the following event handlers:
FieldDefaultingFieldVerifyingRowSelectedRowSelecting
These event handlers are designed for different purposes.
We recommend that you not invoke the Insert, Update, and Delete methods on a PXCache object in the following event handlers:
RowInsertingRowUpdatingRowDeleting
Changes to PXCache in these event handlers can lead to data inconsistency.
To prevent the error from occurring, you should remove the invocation of the Insert, Update, or Delete method of PXCache from the event handler and rework the related business logic.
This diagnostic is displayed for the RowInserting, RowUpdating, and RowDeleting event handlers only if the Enable additional diagnostics for ISV Solution Certification option (in Tools > Options > Acuminator > Code Analysis) is set to True.
public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
{
protected virtual void _(Events.RowSelecting<SOOrder> e)
{
var setup = SelectSetup();
Base.Caches[typeof(SOSetup)].Insert(setup); // The PX1044 error is displayed for this line.
}
}