Questions tagged [enum]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
91 views

How can I use String in enum for Apex?

I have created one static string in apex like private static string HARSWARE_SOFTWARE= 'Hardware and Software'; and now this variable I am using in ENum like public Enum PSServices{...
1
vote
1answer
55 views

Does APEX support factory enum method from value idiom?

Apex is supposed to be based on Java which supports factory method in enums types. global enum CheckResult { PENDING, PASSED, FAILED; public static CheckResult fromResult(Boolean aBoolean) { ...
1
vote
0answers
117 views

Passing enum value to AuraEnabled method [duplicate]

I have an @AuraEnabled method that has an enum as a parameter. How do I pass this in from a Lightning component? Component code: var action2 = component.get("c.doSomething"); action2.setParams({ ...
0
votes
1answer
25 views

How can I increment value of Enum?

When I declare Enum class public Enum X{A,B,C} and I have Enum variable X y and I need to increment that value, in other languages I could just write y++ to increment it, that is, to change A to B, B ...
3
votes
1answer
327 views

Pass an enum value from lightning controller to Apex

Is it possible to pass an enum value from lightning controller to Apex? Here is what I tried lightning component part const action = component.get("methodC"); action.setParams({p: "VIEW"}); ...
8
votes
1answer
1k views

Switch: Enum value used in 'when expression' should be unqualified

Background I am getting this error message three times: Enum value used in 'when expression' should be unqualified In relation to this code: Schema.DisplayType fieldType = getType(fieldName); ...
10
votes
1answer
610 views

What happened to Trigger.Operation?

A new enum TriggerOperation is documented but no corresponding variable has been added to the Trigger Context Variables documentation. I've just found out that using API 43.0, a reference to Trigger....
2
votes
2answers
423 views

Does Enum support hyphens?

I am trying to create an enum datatype for relationships in my apex class. Below is the code I am using: public Enum Enum_RelationShipCode {Father, Mother, Brother, Sister, Uncle, Aunt, Brother-In-...
0
votes
2answers
6k views

Check if certain string exist in my enum values - salesforce

In My ENUM a list of values is added and I need to check if certain string values are in my ENUM and which is dynamically checked through a loop. public Enum KeyValues{CaseNumber, Name, OwnerId, Id} ...
1
vote
1answer
31 views

Is SoapType.Decimal a valid value?

Documentation for SoapType enum does not list Decimal as a member. But it's possible to compile a class which uses SoapType.Decimal. Could this be a problem if we use such code in a managed package?
10
votes
1answer
62 views

Is there a maximum number of Enum items?

The documentation on Enums doesn't specify: Is there a maximum number of Enum items?
10
votes
1answer
434 views

Enums as Map keys don't work in Batchable

I'm running into some weird behavior when using an Enum as a Key in a map. This same code works fine in other contexts, but not when in batch. I have an Enum to represent currency types: public ...
2
votes
1answer
197 views

Reference Enum on Visualforce page

Is there any way to reference a Enum in a Visualforce page? Either for comparison or display? Something like <div> {!MyEnum.Status1} </div>
1
vote
1answer
362 views

Enums - Expression of type 'X' has no member named 'Y'

Consider the following method: public string WriteBoundary( EndingType endingType) { string boundary = ''; if (endingType == EndingType.Cr) {// <- Error! boundary += '\n'; ...
5
votes
2answers
4k views

String to enum value [duplicate]

How can I convert String to enum value? public enum Season {WINTER, SPRING, SUMMER, FALL} Season season1; String winterString = 'WINTER'; season1 = winterString; <-- This gives error of course, ...