0

We have below line in a VisualForce page.

<apex:image id="theImage" value="{!$Resource[customLogo]}" />

CustomLogo is read from Custom settings (Name of the static resource). This works perfect in Managed Package Development.

Once installed in a subscriber org, it's giving error,

Static Resource named testimage does not exist. Check spelling

But it does exist, when you create a VF page (below) with same code, it runs with no error.

<apex:page >
    <apex:image id="theImage" value="{!$Resource['testimage']}" />
</apex:page>

Any thoughts why this is happening? and any workarounds to fix this please. Appreciate any help.

  • Once the pkg is installed have you entered the values in your Custom Setting? – RCS Apr 10 '18 at 4:51
  • @RCS yes, entered value is 'testimage' and it's in the error message as well, it looks like it cannot find the static resource. – Pasan Eeriyagama Apr 10 '18 at 4:56
1

Your Visualforce pages run in their own namespace'd context, so by default, that's what you'll get, resources in your own package (even static resources, pages, etc). The only solution I can think of immediately would be to use the resource URL instead:

<apex:image value="{!resourceUrl}" />

Where resourceUrl would be something like:

/resource/testimage

If you do this, you'll have to reference your own static resources using the namespace convention:

/resource/yourns__testimage

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.