Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 1.6 KB

PX1058.md

File metadata and controls

38 lines (30 loc) · 1.6 KB

PX1058

This document describes the PX1058 diagnostic.

Summary

Code Short Description Type Code Fix
PX1058 A PXGraph instance cannot save changes to the database during the PXGraph initialization. Error Unavailable

Diagnostic Description

A PXGraph instance cannot save changes to the database during the PXGraph initialization (that is, in PXGraph constructors, in the Initialize method overridden in PXGraphExtension, or handlers subscribed at run time through the static InstanceCreated member of PXGraph).

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.

Example of Incorrect Code

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.
        }
    }
}

Related Articles

PXGraph