Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 2.23 KB

PX1089.md

File metadata and controls

46 lines (33 loc) · 2.23 KB

PX1089

This document describes the PX1089 diagnostic.

Summary

Code Short Description Type Code Fix
PX1089 The state of fields and actions cannot be configured in the action delegates. Error Unavailable

Diagnostic Description

The UI presentation logic cannot be configured in the action delegates.

This rule applies to the configuration of PXFieldState that is performed with the following methods:

  • The static SetVisible, SetEnabled, SetRequired, SetDisplayName, SetReadOnly, SetVisibility, and SetNeutralDisplayName methods of PXUIFieldAttribute
  • The SetList, AppendList, and SetLocalizable methods of PXStringListAttribute and PXIntListAttribute
  • The SetEnabled, SetVisible, SetCaption, and SetTooltip methods of PXAction

The UI presentation logic can be implemented in the following places:

  • The RowSelected event handler
  • The constructor of the graph (which can be used for the implementation of the common UI presentation logic; this logic doesn't depend on particular values of the data record)

To prevent the error from occurring, you can move the code that changes the state of the field or action to the RowSelected event handler or to the graph constructor.

Example of Incorrect Code

public class SOOrderEntry : PXGraph<SOOrderEntry, SOOrder>
{
    public PXSelect<SOOrder> Orders;
    public PXAction<SOOrder> Release;
    
    protected virtual IEnumerable release(PXAdapter adapter)
    {
        Release.SetVisible(false); //The PX1089 error is displayed for this line.
        PXUIFieldAttribute.SetEnabled<SOOrder.Hold>(sender, null, false); //Another PX1089 error is displayed for this line.
    }
}

Related Articles