Salesforce - Static Resources


Advertisements

The user interface in a Visualforce base can display dynamic content the value of which keeps changing based on user responses. But there are times when we need some content which should not change with the change in values of other components in the page. For example, an image file may be required to remain constant. Such content which cannot be changed in a page is known as a static resource.

Following are a few static resources in Salesforce −

  • Images
  • Javascript Files
  • Flash files
  • CSS files

The steps to create a static resource are as below.

Create a Static Resource container

Go to Develop → Static resource and mention the values for name, description and file location for the static resource.

Startic Resource 1

Upload a Static Resource

Click Save in the above screen to get the file attached to the User Interface controller.

Static Resource

Reference the Static Resource

Next we create the apex code as in the following screenshot to reference the static object we created above.

Startic Resource Code

Output

Running the above apex code will generate the following output. The output shows a static resource.

Startic Resource Result

Useful Video Courses


Video

Salesforce Online Training

49 Lectures 3.5 hours

Manigandan Jagadeesan

Video

Salesforce Certified Administration

113 Lectures 13 hours

Eduonix Learning Solutions

Video

A Practical Guide To SFDX and Salesforce CLI

37 Lectures 3 hours

Manish Choudhari

Video

Cloud Computing with SALESFORCE HEROKU

22 Lectures 4.5 hours

Pranjal Srivastava

Video

Salesforce Report and Dashboard

43 Lectures 7 hours

Debasis Jena

Video

Salesforce Lightning Components Development Tutorial

54 Lectures 8 hours

SYED CHAND SHAH

Advertisements