+ Start a Discussion

How to reference Static Resource from an OnClick Java Script Button

I have a button on a related list that executes some java script when its clicked. I would like to reference a Static Resource in the java script. Any inputs?



Ron HessRon Hess

sure, you can do this.  Static resource is an expression that looks like this : $Resource.filename,

see examples for URLFOR()


some detail would help me understand.  is it an image? flash SWF, javascript function ? that you are trying to reference ?


see docs on Static Resource also.


Hi There,


I have the same problem. I have a javascript function saved in a file as a static resource.


Have a custom button 'Dial' on Contact Page Layouts. When I click on this button I need to run that function. How do I achieve this? 


If I include the resource as below, the system gives me a syntax error. Any help would be appreciated.