+ Start a Discussion
CraigHCraigH 

unable to compile URLFOR

Hi

 

I am trying to access an image file in a static resource archive:

 

 

<apex:page >
<!-- Begin Default Content REMOVE THIS -->
<h1>Congratulations</h1>
This is your new Page
{!URLFOR(!$Resource.test2, 'simmlogo.gif')}
<!-- End Default Content REMOVE THIS -->
</apex:page>  

 

<apex:page >

<h1>Congratulations</h1>

This is your new Page

 

{!URLFOR(!$Resource.test2, 'simmlogo.gif')}

 

</apex:page>  

 

However, when I try to compile, I get:

 

Error: Incorrect parameter for function not(). Expected Boolean, received Text

 

 

Any ideas on what is wrong??

Best Answer chosen by Admin (Salesforce Developers) 
aballardaballard

It's that exclamation mark (which is the not operator), preceding the $resource... parameter.  Try just

 

{!URLFOR($Resource.test2, 'simmlogo.gif')}

All Answers

aballardaballard

It's that exclamation mark (which is the not operator), preceding the $resource... parameter.  Try just

 

{!URLFOR($Resource.test2, 'simmlogo.gif')}

This was selected as the best answer
CraigHCraigH

Good catch - thanks!

 

I copied the code directly from the VF reference guide under apex:image - also a typo in there as well