I am using the following code to display formula field:-

<apex:outputField value="object__c.customFormulaField__c" />

Below is the controller code:-

   String queryString = 'Select Id,Customer_Status__c from Messages__c';
   List<Messages__c> listMessage =  new List<Messages__c>();  
   for(Messages__c msg : Database.query(queryString)){

Below is the VF code:-

  <apex:repeat value="{!listMessage}" var="mod">
  <apex:outputField value="mod.Customer_Status__c" />

Below is the formula where Status__c is some other picklist field and Customer_Status__c is the formula field below which is to be displayed in visualforce.

   IF(AND(ISNULL(Opened__c),ISPICKVAL(Status__c,'Sent')) ,'New-Unread', 
   IF(AND(NOT(ISNULL(Opened__c)),ISPICKVAL(Status__c,'Sent'))        ,'Read',TEXT(Status__c)))

But it is not displaying . Can anybody tell me how to display the formula field in a visualforce page ? Thanks in Advance.

  • 1
    can you show the formula and the controller? – PepeFloyd Jan 20 '15 at 16:25

I guess you are taking the value of outputfield incorrectly, It should have been value="{!mod.Customer_Status__c}" rather then value="mod.Customer_Status__c".


You should be able to display it just like any other field, just make sure that the user viewing the page has access in their profile to that field.

  • No user has got all the permissions but still the field is not displaying. – user3361920 Jan 20 '15 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.