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
dipudipu 

How to get the relative URL for the static resource in a controller?

I want to get the relative URL for the static resource in a controller. The StaticResrouce object does not seem to have any information about the number (1300899525000)  I see in the relative URL.

https://na7.salesforce.com/resource/1300899525000/Image_DefaultProductIcon

Best Answer chosen by Admin (Salesforce Developers) 
dipudipu

Well it seems that long number is not required. Just resource/Image_name works just fine.

/resource/Image_DefaultProductIcon

 

All Answers

dipudipu

Well it seems that long number is not required. Just resource/Image_name works just fine.

/resource/Image_DefaultProductIcon

 

This was selected as the best answer
JD BellJD Bell
In case anyone else comes across this, the long number is a time stamp based on the resource's last modified date. It functions as a cache buster, but it's optional and can be any number.