This document describes the PX1081 diagnostic.
Code | Short Description | Type | Code Fix |
---|---|---|---|
PX1081 | Actions cannot be executed during the PXGraph initialization. |
Error | Unavailable |
Actions cannot be executed during the PXGraph
initialization (that is, in PXGraph
constructors, in the Initialize
method overridden in PXGraphExtension
, or in handlers subscribed at run time through the static InstanceCreated
member of PXGraph
). During the PXGraph
initialization, PXGraph
is not yet ready for execution of the actions.
During the PXGraph
initialization, you can configure basic UI presentation logic and can make sure that all necessary configuration data for the screen is available. Any other business logic should not be executed during the PXGraph
initialization.
Actions can be executed in the following places:
- Another action delegate
- Processing delegates:
PXLongOperation.StartOperation()
andPXProcessingBase.SetProcessDelegate()
- The
PXGraph.Persist()
method FieldUpdated
andRowUpdated
event handlers- Contract-based API endpoint adapters
- The
PXGraph.ExecuteUpdate
method
To prevent the error from occurring, you should remove from the PXGraph
initialization the code that executes an action and rework the related business logic.
public class SOOrderEntry : PXGraph<SOOrderEntry, SOOrder>
{
public PXAction<SOOrder> Release;
...
public SOOrderEntry()
{
Release.Press(); // The PX1081 error is displayed for this line.
Cancel.Press(new PXAdapter(...)); // Another PX1081 error is displayed for this line.
}
}