Skip to content

Latest commit

 

History

History
69 lines (52 loc) · 3.3 KB

PX1027.md

File metadata and controls

69 lines (52 loc) · 3.3 KB

PX1027

This document describes the PX1027 diagnostic.

Summary

Code Short Description Type Code Fix
PX1027 The CompanyMask, CompanyID, Notes, Files, DatabaseRecordStatus, and DeletedDatabaseRecord fields cannot be declared in DACs. The name of a DAC field also cannot begin with the Company prefix. Error Available

Diagnostic Description

The CompanyMask, CompanyID, Notes, Files, DatabaseRecordStatus, and DeletedDatabaseRecord table columns are handled automatically by the system and the corresponding fields cannot be declared in DACs. A name of a DAC field also cannot begin with the Company prefix because such DAC fields are incorrectly handled by the system when the data in the database table is shared between multiple tenants via Acumatica Company Masks.

The code fix works only for DAC fields with incorrect names and removes the unnecessary field from the DAC. DAC fields which name starts with the Company prefix do not have a code fix.

This diagnostic is displayed as a warning for the DeletedDatabaseRecord field if the Enable additional diagnostics for ISV Solution Certification option (in Tools > Options > Acuminator > Code Analysis) is set to False.

Example of DAC Fields with Forbidden Names

public partial class POOrder : PXBqlTable, IBqlTable
{
    #region CompanyID
    public abstract class companyId : IBqlField { } // The first PX1027 error is displayed for this line.

    [PXDBString(IsKey = true, InputMask = "")]
    [PXDefault]
    [PXUIField(DisplayName = "Company ID")]
    public string CompanyID { get; set; } // The first PX1027 error is also displayed for this line.
    #endregion

    #region  DeletedDatabaseRecord
    public abstract class deletedDatabaseRecord { } // The second PX1027 error is displayed for this line.
    [PXDefault]
    [PXUIField(DisplayName = "Deleted Flag")]
    public string DeletedDatabaseRecord { get; set; } // The second PX1027 error is also displayed for this line.
    #endregion
}

Example of Code Fix

public partial class POOrder : PXBqlTable, IBqlTable
{

}

Example of DAC Fields with the Company prefix

public partial class PRClaim : PXBqlTable, IBqlTable
{
    #region CompanyLocation
    public abstract class companyLocation : PX.Data.BQL.BqlString.Field<companyLocation> { }

    [PXDBString]
    [PXUIField(DisplayName = "Company Location")]
    public string CompanyLocation { get; set; } 
    #endregion
}

Related Articles