Acumatica Attributes in DAC Code

By | February 2, 2024

Acumatica provides a powerful framework for creating and customizing data structures through the use of Data Access Classes (DACs). One of the key features that contribute to the flexibility and extensibility of Acumatica data structures is the use of attributes.

In this blog post, we will dive into the world of Acumatica attributes used in DAC code, exploring their significance and types. Let’s see how attributes enhance the definition and behavior of DAC fields.

Attributes:

Attributes in Acumatica are metadata tags applied to DAC fields, providing additional information about how the field should be treated or presented. They impact various aspects, including user interface rendering, validation rules, and database interactions.

Commonly Used Attributes

1. PXDBString

The `PXDBString` attribute defines a string field in the database. It allows you to specify the maximum length, whether the field is a key, and whether it should be stored as Unicode.

Example:

 [PXDBString(30, IsUnicode = true, InputMask = “”)] [PXUIField(DisplayName = “Customer ID”)]

2. PXDefault

The `PXDefault` attribute sets the default value for a field. This is useful for fields that should have a predefined value when a new record is created.

Example:

[PXDefault(“NEW”)]

[PXDBString(2, IsFixed = true)]

[PXUIField(DisplayName = “Status”)]

3. PXUIField

The `PXUIField` attribute controls the appearance and behavior of fields in the user interface, including labels, visibility, and enabled/disabled states.

Example:

[PXUIField(DisplayName = “Customer Name”, Visibility = PXUIVisibility.SelectorVisible)]

[PXDBString(60, IsUnicode = true)]

4. PXSelector

The `PXSelector` attribute associates a field with a selector control, providing a list of values for the user to choose from.

Example:

[PXSelector(typeof(Search<InventoryItem.inventoryID>))]

[PXDBInt]

[PXUIField(DisplayName = “Inventory ID”)]

 Advanced Attributes

  • PXFormula

The `PXFormula` attribute allows you to define calculated fields based on formulas involving other fields within the DAC.

Example:

[PXFormula(typeof(Switch<Case<Where<Current<SOOrder.orderQty>, Equal<decimal0>>, int1>, int0>))]

[PXInt]

[PXUIField(DisplayName = “Zero Quantity Flag”)]

  • PXDimensionSelector

The `PXDimensionSelector` attribute provides a specialized selector for dimension fields, ensuring adherence to dimension rules.

Example:

[PXDimensionSelector(INItemSite.dimension, typeof(Search<DimensionValue.valueID, Where<DimensionValue.dimensionID, Equal<INItemSite.dimension>>, OrderBy<Asc<DimensionValue.sortOrder>>>), typeof(DimensionValue.valueID))]

[PXDBString(30, IsUnicode = true)] [PXUIField(DisplayName = “Location ID”)]

About Us
Greytrix – a globally recognized and one of the oldest Sage Development Partner and a Salesforce Product development partner offers a wide variety of integration products and services to the end users as well as to the Partners and Sage PSG across the globe. We offer Consultation, Configuration, Training and support services in out-of-the-box functionality as well as customizations to incorporate custom business rules and functionalities that require apex code incorporation into the Salesforce platform.

Greytrix has some unique solutions for Cloud CRM such as Salesforce Sage integration for Sage X3Sage 100 and Sage 300 (Sage Accpac). We also offer best-in-class Cloud CRM Salesforce customization and development services along with services such as Salesforce Data MigrationIntegrated App developmentCustom App development and Technical Support to business partners and end users.
Salesforce Cloud CRM integration offered by Greytrix works with Lightning web components and supports standard opportunity workflow. Greytrix GUMU™ integration for Sage ERP – Salesforce is a 5-star rated app listed on Salesforce AppExchange.

The GUMU™ Cloud framework by Greytrix forms the backbone of cloud integrations that are managed in real-time for processing and execution of application programs at the click of a button.

For more information on our Salesforce products and services, contact us at salesforce@greytrix.com. We will be glad to assist you.