2

Is there any way to reference a Enum in a Visualforce page? Either for comparison or display?

Something like

<div>
    {!MyEnum.Status1}
</div>
0

1 Answer 1

2

Not without Apex, I believe. You'd need to add it as a property to your controller/extension:

public MyEnum enumInstance { get { return MyEnum.Status1; } }

Then you can reference it normally:

<apex:outputText value="{!enumInstance}" />
1
  • That. Is. Crazy! It's public, yet you have to create a get property for each value in the Enum!. SF is great, but things like this are so frustrating, and needless
    – cyberspy
    Dec 6, 2019 at 12:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .