This document describes the PX1030 diagnostic.
| Code | Short Description | Type | Code Fix |
|---|---|---|---|
| PX1030 | The PXDefault attribute of the field is used incorrectly. |
Warning (ISV Level 1: Significant) or Error | Available |
For the information on how to use the PXDefault attribute correctly, see Default Values.
If the PXDefault attribute is used without the PersistingCheck property set to Nothing, the attribute used on a custom field defined in PXCacheExtension can prevent persisting of records to the database.
If a DAC or DAC extension includes an unbound field with the PXDefault attribute that doesn't have PersistingCheck = PXPersistingCheck.Nothing, an error is displayed. For this error, you can select one of the following two code fixes:
- A code fix that changes the
PXDefaultattribute toPXUnboundDefault - A code fix that adds
PersistingCheck = PXPersistingCheck.Nothingto thePXDefaultattribute
If a DAC extension includes a bound field with the PXDefault attribute that doesn't have PersistingCheck = PXPersistingCheck.Nothing, a warning is displayed. For this warning, the code fix adds PersistingCheck = PXPersistingCheck.Nothing to the PXDefault attribute.
The diagnostic is not displayed for the fields of the DACs that contain only unbound fields (such as the DACs for filters on inquiry or processing forms).
public class CAAdjExtension : PXCacheExtension<CAAdj>
{
#region UsrCADocLineCntr
public abstract class usrCADocLineCntr : IBqlField
{
}
[PXDBInt]
[PXDefault(0)] // The PX1030 warning is displayed for this line.
public virtual int? UsrCADocLineCntr { get; set; }
#endregion
#region Selected
public abstract class selected : PX.Data.IBqlField
{
}
[PXBool]
[PXDefault(false)] // The PX1030 error is displayed for this line.
[PXUIField(DisplayName = "Selected")]
public virtual bool? Selected { get; set; }
#endregion
}public class CAAdjExtension : PXCacheExtension<CAAdj>
{
#region UsrCADocLineCntr
public abstract class usrCADocLineCntr : IBqlField
{
}
[PXDBInt]
[PXDefault(0, PersistingCheck = PXPersistingCheck.Nothing)]
public virtual int? UsrCADocLineCntr { get; set; }
#endregion
#region Selected
public abstract class selected : PX.Data.IBqlField
{
}
[PXBool]
[PXUnboundDefault] //First code fix option
//[PXDefault(false, PersistingCheck = PXPersistingCheck.Nothing)] is another code fix option.
[PXUIField(DisplayName = "Selected")]
public virtual bool? Selected { get; set; }
#endregion
}