function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mstev45mstev45 

Using Image formula field in VisualForce page

Hi, i am new to using visualforce and i am trying to create a detail page to overright the current detail page for a custom object. The custom object contains a picklist field containing 3 values. I have created a custom formula field using Image and Case to display the values in the picklist as images in the detail view. the formula in the field is:

 

IMAGE(
CASE( Status__c ,
"Not Received","https://emea.salesforce.com/resource/1242640894000/RedFlagStatus",
"Received", "https://emea.salesforce.com/resource/1242641297000/YellowFlagStatus",
"Checked","https://emea.salesforce.com/resource/1242641338000/GreenFlagStatus",
"Status"),
"Status") 

 

 In my visualforce page i am using <apex:outputField value="{!CustomObject__c.Status__c"/> to display the custom formula field. However the imgae is not displaying, instead it has, <img src="https://emea.salesforce.com/resource/1242641297000/YellowFlagStatus" alt="Status" border="0"/> in the field output. If anyone can help with how i should display the picklist values as images on the detail page of a record then that would be great.

 

Matt.

Best Answer chosen by Admin (Salesforce Developers) 
BigGeoBigGeo

I was able to do it with outputText and specifying escape parameter as false:

 

<apex:outputText value="{!Object.ImageFormulaField__c}" escape="false"/>

 

Regards!

All Answers

MATTYBMEMATTYBME

Try something similar to this:

 

<apex:column Value="{!c.status}" style="{!IF(c.Status='New', 'color:brown;font-weight: bold',IF(c.Status='In Progress', 'color:green;font-weight: bold',IF(c.Status='Triaged', 'color:orange;font-weight: bold',IF(c.Status='On Hold','color:red;font-weight: bold',IF(c.Status='Resolution Provided','color:blue;font-weight: bold',IF(c.Status='Closed - Duplicate','color:black;font-weight: bold',IF(c.Status='Closed','color:black;font-weight: bold','color:grey')))))))}"/>

 

 

 

BigGeoBigGeo

I was able to do it with outputText and specifying escape parameter as false:

 

<apex:outputText value="{!Object.ImageFormulaField__c}" escape="false"/>

 

Regards!

This was selected as the best answer
Manu ErwinManu Erwin

#awesome - Thanks - just what I needed in a pinch!

SwayampravaSwayamprava

i am also thnakfull !!

sausalito devsausalito dev

Don't forget to set the remote site settings for URLs outside of Salesforce in Your Name | Setup | Security Controls | Remote Site Settings.