Home SALESFORCEAPEX Enum Data Type in Salesforce

Enum Data Type in Salesforce
• Enum (or enumerated list) is an abstract that stores one value of a finite set of specified identifiers.
• To define an Enum, use enum keyword in the variable declaration and then define the list of values.
• By creating this Enum, you have created a new data type called Season that can be used as any other data type.

Enum Data Type Methods
Although Enum values cannot have user-defined methods added to them, all Enum values have some implicit methods similar to Java.
• Ordinal() returns the position of the item in the list(from 0)
• Name() returns name of the Enum item as String.
• Values() is a static method that returns the list of values.

You may also like

Leave a Comment