I know all the resources are in here but I don’t have time.
Basically need to produce a URL for my Conga template to bring in an image.
https://na15.salesforce.com/ dynamic to org
resource/ is static
1421083611000 is ??? not sure where this comes from. The resource ID is 081i0000000XWEM. I’m wondering if there is a way to get 1421083611000.
RECON__wi_ is static
wind is from field RECON__Icon__c
.png is static
The number you see there is the unix timestamp for the date that this resource was last changed. It is actually optional. It’s only used as a “cache buster” to helping your browser not use a cache when the file is updated.
Option 1: Don’t use that number at all.
This should work just fine. However, your browser will try to use its cache whenever it can. This is probably good for an image that does not change.
Option 2: Make up a number and hardcode it.
This will work fine as well, however it will exhibit the same caching behavior as Option 1.
Option 3: Figure out the last modified timestamp of the resource and use it
This option has the most desirable caching behavior in my opinion.
Option 4: Use the current timestamp for “right now”.
This will never be cached and will always be requested from the server. Seems kinda wasteful to me. But there are some times where this is needed.
Awesome. Good to know bout the timestamp. That works.
How about getting the “na15.salesforce.com/” part?
Can’t you just use a relative link instead of absolute?
I suppose I can also hack it out of the address bar. How is that done?
This method can also be an issue as the Site URL will be different from a skuid page than a static resource.
So I basically need the salesforce server in which org is on. “na15” in this case.
This can be alternatively setup as part of the app in a “Custom Setting”. This is beyond something I’ve ever done, but can apex be run to set this setting in custom setting such that the formula field points to the right static resource?
If upon installing an app from the appexchange some apex can be used to update a system setting, then BAM!
You can get the Instance by querying the Organization object, and grabbing the InstanceName field off it, then you could use the instance in merge syntax like this:
So the end result would be something like:
That works too. Not sure what I like better now. Formula fields are better cause then there’s is less code to manage. But then I have to set the “na15” via Custom Setting upon install using Apex.
This is assuming that everything between https:// & /resource/RECON__wi_wind can be acquired with APEX upon install and populate a custom setting with this value.