I am making a managed package that contains an app that uses a document type image as a logo. I use the same logo on a VisualForce page in the same package, but that file is actually stored as a static resource.

I would like to only include the file once in the package, so I want to delete the static resource image, and simply reference the document image in the VF page.

I read that I can use the tag, and the url should be in the form : " /servlet/servlet.FileDownload?file=xxxxxxxxxxx" where xxxxxxxxxxx is the the unique id of theDocument/Attachment record containing the image.

Would that ID stay the same if I add the image to a managed package and it gets installed on a different org, or would the new org have a copy of the file with a different ID?

1 Answer 1


No, the ID will not remain the same. You'll need to find the document by using a query, either embedded in a controller, custom label, or custom setting, or by using JavaScript. There's no good way to statically reference a document.

You should prefer the use static resources, not documents, as they are referenced by name, and are available using {!$Resource.resourceName}. Static resources are portable, are namespaced in the case of managed packages, and can be statically referenced.

You must log in to answer this question.

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