This document describes the PX1048 diagnostic.
Code | Short Description | Type | Code Fix |
---|---|---|---|
PX1048 | For the RowInserting and RowSelecting events, only the DAC instance that is passed in the event arguments can be modified in the event handler. |
Error | Unavailable |
For the RowInserting
and RowSelecting
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
event handler 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.
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);
}