I keep seeing conflicting information about whether this is possible, so hoping the supreme court of StackEx can definitively rule!
I have a managed package that queries a field on the campaign object containing the name of a Static Resource. It then uses a dynamic reference on a VF page to display that SR as an image. In the packaging org, it works great, and in an installed org, it works for any static resource I have include in the package (so is in same namespace). But if I directly load a new SR into my installed org, and add that name, I get an error saying the resource is not found. I can see why a package wouldn't be allowed to access a local SR, but I keep seeing posts suggesting it is possible, so hoping I am just missing a step...
The code is similar to this though I get the resource name from a field on a campaign via a query. If I include KWLogo in the package, I can reference it this way, but if I install the package, upload a local resource called something like KWLogo1 into the target org, and try and reference it on the page, I get a resource not found error:
<apex:page controller="StaticRTest" >
<apex:image rendered="{!NOT(ISNULL(sImageSource))}" url="{!$Resource[sImageSource]}"/>
<br/>
<br/>
<h1>Congratulations</h1>
This is your new Page
</apex:page>
public with sharing class StaticRTest {
public String sImageSource {get;set;}
public StaticRTest () {
sImageSource = 'KWLogo';
}
}
e.g.
This link suggests it can be done (though not how), but this link suggests otherwise?