1

Ok, I have a formula field that references a static resource image. This formula field displays correctly within the standard Salesforce UI but when I try and add the field to a custom visualforce field I cannot get it to display. I have tried every bit of syntax that I can find but I am not hitting on the correct one. Can anyone help?

Formula Field (Status_Icon__c):

IF(
Auto_Status__c = "Expired",
IMAGE("/resource/Expired","! Expired"),

IF(
Auto_Status__c = "Current",
IMAGE("/resource/Current","! Current"),
""
)
)

VF:

            <apex:column style="align:center;text-align:center;">
                <apex:facet name="header">Status</apex:facet>
                <apex:image url="{!Lic.Status_Icon__c}" height="50px"/><br />
                <apex:outputtext >{!Lic.Status_Icon__c}</apex:outputtext>
            </apex:column>

Sample from VF page:

enter image description here

2

You need to disable "escaping", a feature designed to prevent script injections. Since you control the formula, you can disable this automatic protection:

<apex:outputtext escape="false" value="{!Lic.Status_Icon__c}" />

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.