Include static image, javascript or other static resource in a Salesforce page

When developing Salesforce pages you might need to include your own images, javascript libraries or any other static resource. Doing this is easy but it first requires uploading the resource to Salesforce. You can do this by opening:

Salesforce Setup > Static Resouce > New

From there you need to upload the file and giving it a name that should be unique for the whole organisation. Also the max file size is 5 MB. Once the file is uploaded to your Salesforce you can include it in your template with the following coe:

<apex:includeScript value="{! $Resource.your_file_name }"/>

You just need to replace your_file_name with the name you have chosen at the time of the upload.

Leave a Reply

Your email address will not be published. Required fields are marked *