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
Chad RitchieChad Ritchie 

Visualforce Merge Field Question

Hey guys,

I'd like to have the following formula (which pulls in a heatmap of NY from the Documents Tab)
<apex:page standardcontroller="Contact" showHeader="false">
     <apex:image id="NY" value="{!'/servlet/servlet.FileDownload?file=0F01k00000002Wn'}" width="1920" height="940"/>
</apex:page>

use an if statement/merge field to verify that the record's state is actually NY. For example, I'd like in Excel terms to do if(contact.state__c = "NY", <apex:image id="NYJan19" value="{!'/servlet/servlet.FileDownload?file=0F01k00000002Wn'}" width="1920" height="940"/> ,"")

The reason being that I plan on having an image for every state so I need to merge in the record's state field so I can properly match them. Otherwise this would require 50 visualforce pages.

Thanks!!
Best Answer chosen by Chad Ritchie
sridhar v 7sridhar v 7
Hi Chad,

Try the below option. hopefully, it works for you.

--> use rendered attribute. 

<apex:page standardcontroller="Contact" showHeader="false">
     <apex:image id="NY"  rendered="{!Contact.State__c == 'NY'}" value="{!'/servlet/servlet.FileDownload?file=0F01k00000002Wn'}" width="1920" height="940"/>
</apex:page>

Thanks,