Base Enum Extensions
A Base Enum Extension (AxEnumExtension) modifies an existing base enumeration without altering its original source code. Enum extensions allow you to add new values to standard enumerations and modify properties on existing values — enabling customisation while preserving upgradeability.
Enum extensions are created by right-clicking a base enum in the AOT and selecting Create extension. This creates an AxEnumExtension object named <OriginalEnumName>.<YourModelName> in your model.
What Can Be Extended
| Capability | Description |
|---|---|
| Add Enum Values | New values appended to the enumeration. |
| Modify Existing Values | Change properties (Label, HelpText) on existing values via ValueModifications. |
| Modify Enum Properties | Change top-level properties via PropertyModifications. |
Enum extensions cannot remove existing values or change value integers. New values are assigned integers automatically by the system to avoid collisions across extensions.
Extension Naming Conventions
| Pattern | Example | Description |
|---|---|---|
| Extension object | SalesStatus.SAMOModel | Base enum name + dot + your model name. |
| New values | SAMOPendingReview | Prefix with your solution abbreviation. |
Best Practices
- Always prefix new values with your solution abbreviation to avoid collisions with other extensions.
- Do not rely on integer values of extension enum values — they are auto-assigned and may change between builds.
- Use
switchwithdefault— always include adefaultcase inswitchstatements on extensible enums, since other extensions may add values your code does not recognise. - Set
IsExtensible = Yeson custom enums you create if other models may need to extend them.
Working with Extensible Enums in Code
Extensible enums require special handling because the set of values is not known at compile time:
// WRONG — do not compare against a hardcoded integer
if (salesTable.SalesStatus == 3)
// CORRECT — always use the symbolic name
if (salesTable.SalesStatus == SalesStatus::Invoiced)
// CORRECT — handle unknown values in switch
switch (salesTable.SalesStatus)
{
case SalesStatus::Backorder:
// ...
break;
case SalesStatus::Invoiced:
// ...
break;
default:
// Handle values added by extensions
break;
}
Properties
| Property | Display Name | Type | Description |
|---|---|---|---|
| Enum ExtensionAxEnumExtension | |||
| Name | Name | String | The name of the extension element (follows BaseEnum.Package naming). |
| IsObsolete | Is Obsolete | NoYes | Whether the extension is deprecated. Values: No (0), Yes (1). |
| Visibility | Visibility | CompilerVisibility | Access level visibility. Values: Private (0), Protected (1), Public (2), Internal (3), InternalProtected (4). |
| Tags | Tags | String | Tags for this element separated by semicolon. |