This document describes the PX1058 diagnostic.
| Code | Short Description | Type | Code Fix |
|---|---|---|---|
| PX1058 | A PXGraph instance cannot save changes to the database during the PXGraph initialization. |
Error | Unavailable |
A PXGraph instance cannot save changes to the database during the PXGraph initialization. The following code elements are considered to be a part of the graph initialization:
- The
PXGraphandPXGraphExtensionconstructors - The
Initializemethod overridden inPXGraphExtension - The
Initializemethod ofPXGraphthat implements thePX.Data.DependencyInjection.IGraphWithInitializationinterface - The
Configuremethod overridden inPXGraphandPXGraphExtension
To fix the issue, you should remove from the PXGraph initialization the code that saves the changes to the database and rework the related business logic.
public class SWKMapadocSOOrderProcess : PXGraph<SWKMapadocSOOrderProcess>
{
public SWKMapadocSOOrderProcess()
{
int icount = orders.Select().Count;
if (icount > 1)
{
SWKMapadocSOOrder dummy = PXSelect<SWKMapadocSOOrder,
Where<SWKMapadocSOOrder.cloudPk,
Equal<Required<SWKMapadocSOOrder.cloudPk>>>>
.Select(this, 0);
orders.Delete(dummy);
Actions.PressSave(); // The PX1058 error is displayed for this line.
}
}
}