Enum exceptions
Enums in GraphQL are the equivalent of local menus or lists of values in Sage X3. They provide a standardized way to represent predefined values in your data model.
Some local menus cannot be directly translated into Enums. These must be handled using this Enum exceptions function (GESAENUMB).
Exceptions are required when:
-
The Enum must be included in a different package than the one associated with the local menu’s module.
-
The local menu description or values do not comply with GraphQL naming rules. For example, they contain special characters like %, >, =, ;.
How enums are generated
When a node binding record is validated:
-
Most existing local menus in Sage X3 tables are automatically converted into Enums in Sage X3 Services.
-
No additional setup is required.
-
The module defined for the local menu determines the package where the Enum is included.
Naming conventions
US English texts and local menu values are used to define the Enum.
Naming follows standard conventions:
-
PascalCase for Enum names
-
camelCase for Enum values
Here’s an example of a local menu managed through an exception:
-
The Enum name was modified by Sage.
-
The Enum was moved to the x3-master-data package.
-
Enum values were adapted to remove special characters.
When node bindings are validated and packages are generated, a file is created for each Enum in the appropriate lib/enums package directory.
Path: node_modules/@sage/x3-master-data/lib/enums/related-company-settings.d.ts
Generated code:
import { X3EnumDataType } from '@sage/xtrem-x3-gateway';
export declare enum RelatedCompanySettingsEnum {
notRelated = 1,
votingRightsMoreThanOrEqual10Percent = 2,
votingRightsLessThan10Percent = 3
}
export type RelatedCompanySettings = keyof typeof RelatedCompanySettingsEnum;
export declare const relatedCompanySettingsDatatype: X3EnumDataType<"notRelated" | "votingRightsMoreThanOrEqual10Percent" | "votingRightsLessThan10Percent", unknown>;
//# sourceMappingURL=related-company-settings.d.ts.map
- Enums simplify the use of local menus in GraphQL.
- Most are auto-generated, but exceptions must be manually managed.
- Follow naming conventions and use the Enum exceptions function (GESAENUMB) for special cases.
Enum extensions
A standard local menu can be extended with custom values to meet specific business needs. These customizations are known as enum extensions.
For detailed guidance on how to implement and manage Enum extensions, refer to the dedicated documentation.
Screen management
The screen is defined in 2 tabs:
-
The header
-
The List of values tab
Header
This section outlines the key information for Enum exceptions.
List of values
This section displays the different messages related to the local menu.
Error messages
The only error messages are the generic ones.
Tables used
The following tables are implemented by the function:
Table | Table description |
AENUMBDGH [AENUMH] | Enum binding header |
AENUMBDGL [AENUML] | Enum binding lines |