function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ales.pales.p 

Image URL referral

Hello developers,
I'm developing an AppExchange application that use Documentation TAB and I uploaded some GIF images that I need.  When images has been uploaded, Salesforce (Sf) assign them an ID automatically. In order to refer to those images I have to use a link like that:
... with the given ID.
 
The problem is that I have to refer to those images inside Reports, S-Controls and Custom Formula Fields but the given link change every time I install or load my application for my Customers because ID change.
 
So, is there a way to refer to images with the image "Document Name" given while upload???
I'm looking to something like that or similar:
 
Help!!!
Thanks in advance.
 
Alessandro
:smileysad:

Message Edited by Ales.p on 10-12-2006 02:38 AM

ChrisMcLChrisMcL

the IMAGE function may help you. Setup a filter to lookup the same and set the ID using a merge field. I am trying to implement this solution for myself because of the same problem you have.

Here are some official examples of the IMAGE function:

http://salesforce3.sitestream.com/pdf/getting_started_with_images_v1.pdf

Let me know if/when you find a solution

 

James

Municipal Software

ChrisMcLChrisMcL
I found a solution that works for my Print Anywhere package, although, with one caveat: the "oid". I'm still researching what this field is and I'm hoping it doesn't change between clients. Two steps are required:
 
1) created a printer query to get the ID from the Document table using the name field in the where filter.
 
2) Within the template html I replaced the original img src tag id value with {Document.Id}. For example:
 
<img src="/servlet/servlet.ImageServer?oid=##D#########D#D&id={Document.Id}" width="90px" height="90px" style="border-style:none;" />
 
where ##D#########D#D is your actual oid
 
James
Municipal Software
ChrisMcLChrisMcL

The oid is the id field off of Organization. If that changes for each of your application users, then just use the same technique:

{Organization.Id}

I'm not sure if that is the organization of the application users or of the organization that is supporting the application.

Message Edited by ChrisMcL on 10-23-2006 05:04 PM

ales.pales.p
Hello ChrisMcL
thanks for your time.
 
Information and PDF image document provided are very helpful and I found a lot of news but unfortunately this is not what we are looking for.
 
We should show specific Image based on a field value. So we have for example 2 Custom Fields called "Status value" and "Status icon". The first one ("Status value") is a Text field and can be "X" or "Y" or "Z" while field "Status icon" is a formula field that should show respective icons  X.gif or Y.gif or Z.gif . Those 2 fields are used inside Related list, Reports and so on.
 
In this situation it seems that I cannot use DOCUMENTS because I can refer to documents only by {Document_ID} and not by {Document_Name} like X.gif etc... Probably I can do that only for a single instance of SF because {Document_ID} change from instance to instance and we would like to upload it into AppExchange.
 
Thanks again,
Alex
 
 
DevAngelDevAngel
Hi Alex,
 
Yeah, I feel your pain.  I've had to deal with the same issue on more than one occasion.  The solution, although it's not the greatest, is to query the folder in which to packaged your images.  For instance if you create a folder called MyAppImages and put all the iconic and other required images in there, you could query for the folder "Select Id From Folder Where Name = 'MyAppImages'".
 
Once you have the id of the folder you can download the images "Select Id, Name From Document Where FolderId = '<id from above>'".  Now you can loop these results and, if you where clever about putting ids on your img tags that matched your image document names, you can easily set a relative path to correct document for the img src
 
Code:
function setImgImage(imageName, imageId) {
document.getElementById(imageName).src="/servlet/servlet.FileDownload—file=" + imageId;
}

 
The code above is a bit that I've used.   The imageName and imageId args are directly from the second query above and are the Name and Id fields respectively.
 
 
Cheers
ales.pales.p

Hello DevAngel,
I understand your solution but I have to use these images also inside Reports or Related List and not only inside S-Control.

Mybe there are no solutions.

Thank for your time,
Alex