I have a application object with status as a picklist field. The values are Draft and Submitted.

In a page block table in status column.. i want to show a vertical bar of different color based on status value

enter image description here

Class Code

public with sharing class theController
    public List<Application__c> lstApplication{get;set;} 
    public Application__c applicationsrequest{get;set;}
    String Color;

    public OAOARequestHistory()
        lstApplication = [SELECT Id, Name, Editor__c,Status__c 
                            FROM Application__c];

        if(lstApplication != null && lstApplication.size()>0)
            this.applicationsrequest = lstApplication[0];                 

        if(applicationrequest.Status__c == "Submitted")
        if(applicationrequest.Status__c == "Draft")

How do i pass value of colr from apex class to the td background

1 Answer 1


Assuming you have only two values in pick list you can do this as:

       <td style="background-color:{!IF(applicationrequest.Status__c == 'Draft','grey','green')};">

You must log in to answer this question.

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