This document describes the PX1110 diagnostic.
| Code | Short Description | Type | Code Fix |
|---|---|---|---|
| PX1110 | The DAC has a DAC field with the PXDBLocalizableString attribute. Therefore, this DAC must declare a NoteID DAC field. |
Error | Available |
Data Access Classes (DACs) that contain fields with the PXDBLocalizableString attribute must declare a NoteID field. The NoteID field is required for the Acumatica localization framework to properly
store and manage localized field values in the database.
The PXDBLocalizableString attribute is used to mark DAC fields that should support multiple language translations. When such fields are present in a DAC, Acumatica Framework uses the NoteID field
as a reference key to link the localized text values stored in the system database tables.
The PX1110 diagnostic detects DACs that:
- Have at least one field with the
PXDBLocalizableStringattribute - Do not have a
NoteIDfield declared in the DAC and its base DACs
There are some exceptions to the PX1110 diagnostic when a DAC does not require to support localization. The diagnostic will not be triggered in the following cases:
- The DAC has the
PXAccumulatorattribute or an attribute derived from thePXAccumulatorattribute. Such DACs are used for special accumulation scenarios and do not support localization. - The DAC is fully unbound from the database (a virtual DAC). Such DACs do not interact with the database directly and do not require localization support. Since Acuminator does not access the database, it determines whether a DAC is fully unbound based on the following rules:
- A DAC without any DAC fields or with only unbound DAC fields is considered fully unbound.
- A DAC marked with
PX.Data.PXVirtualAttributeis always considered fully unbound even if it has DB bound fields. - A DAC marked with
PX.Data.PXProjectionAttribute,PX.Data.PXAccumulatorAttributeor any other attribute derived fromPX.Data.PXDBInterceptorAttributeis always considered DB bound even if it has only unbound fields. - A DAC with a DB bound
NoteIDfield is considered fully unbound ifNoteIDis the only DB bound field in the DAC and all other fields in the DAC are unbound.
The PX1110 code fix automatically adds the missing NoteID field to the DAC with the following characteristics:
- The
NoteIDfield is added at the end of the DAC field declaration. - Appropriate
usingdirectives (SystemandPX.Data.BQL) are automatically added if needed. - The field is properly wrapped in the
#region NoteID/#endregionblock for consistency.
[PXCacheName("Some DAC")]
public class SomeDac : PXBqlTable, IBqlTable
{
#region DacId
public abstract class dacId : PX.Data.BQL.BqlInt.Field<dacId> { }
[PXDBIdentity(IsKey = true)]
public virtual int? DacId { get; set; }
#endregion
#region Description
public abstract class description : PX.Data.BQL.BqlString.Field<description> { }
[PXDBLocalizableString(512, IsUnicode = true)]
public virtual string? Description { get; set; }
#endregion
// Missing NoteID field - required because Description has PXDBLocalizableString attribute
}[PXCacheName("Some DAC")]
public class SomeDac : PXBqlTable, IBqlTable
{
#region DacId
[PXDBIdentity(IsKey = true)]
public virtual int? DacId { get; set; }
public abstract class dacId : PX.Data.BQL.BqlInt.Field<dacId> { }
#endregion
#region Description
public abstract class description : PX.Data.BQL.BqlString.Field<description> { }
[PXDBLocalizableString(512, IsUnicode = true)]
public virtual string? Description { get; set; }
#endregion
#region NoteID
public abstract class noteID : BqlGuid.Field<noteID> { }
[PXNote]
public virtual Guid? NoteID { get; set; }
#endregion
}