Skip to content
Developerhome
X3

Enums

  Less than to read

Enums are the GraphQL equivalent of Sage X3 Local menus or lists of values.

When a Node binding record is validated, most of the existing local menus in the tables are generated in Sage X3 Services without adding any specific setup. By convention, the module defined for this local menu determines the package the Enum is included in.

The US English texts and the local menu values are used to setup the Enum in Sage X3 Services. PascalCase and camelCase naming conventions are automatically applied.

Some local menus can’t be translated as they are in X3. In those cases, they should be managed as exceptions using the Enum exception function (GESAENUMB). This is done for the following cases:

  • The Enum is included in different package from the package associated with the Local menu’s module.
  • The Local menu description or values do now follow GraphQL naming rules.

The following example shows a Local menu being managed through an Enum exception:

In the above example:

  • The name of the Enum has been modified by Sage.
  • The package of this Enum has been changed to x3-master-data. This is different compared to the module of Local menu's.
  • Enum values have been adapted because original texts contain special characters.

When Node bindings are validated and package generation is finished, a file is created for each Enum in the lib/enums folder. This folder is in the directory of the package defined for the Enum.

In the case of the presented example, the folder is node_modules/@sage/x3-master-data/lib/enums/related-company-settings.d.ts:

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

This code is automatically generated from X3.