This document describes the PX1048 diagnostic.
| Code | Short Description | Type | Code Fix |
|---|---|---|---|
| PX1048 | For the RowInserting, RowSelecting, and FieldUpdating events, only the DAC instance that is passed in the event arguments can be modified in the event handler. |
Error | Unavailable |
For the RowInserting, RowSelecting, and FieldUpdating events, only the DAC instance that is passed in the event arguments can be modified in the event handler.
Modifications to other DAC instances that are done in the RowInserting and FieldUpdating event handlers can lead to data inconsistency. Modifications to other DAC instances that are done in the RowSelecting event handler can lead to unpredictable system behavior.
To prevent the error from occurring, you should remove from the event handler the code that assigns a value to a DAC field and rework the related business logic.
You can move the code from the RowInserting event handler to the RowInserted event handler. As for the code in the FieldUpdating event handler, you can move it to FieldUpdated or RowUpdated event handlers.
protected virtual void SOOrder_RowInserting(PXCache sender, PXRowInsertingEventArgs e)
{
var order = e.Row as SOOrder;
if (order == null) return;
var doc = Orders.Current;
doc.OrderDate = order.OrderDate; // The PX1048 error is displayed for this line.
Orders.Update(doc);
}