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.

2
  • Once the pkg is installed have you entered the values in your Custom Setting?
    – RCS
    Apr 10, 2018 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. Apr 10, 2018 at 4:56

1 Answer 1

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
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .