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
hoagieryderhoagieryder 

Using Icons from Recent Items in Visualforce Page

I am generating a list of accounts in a Visualforce Page and I am trying to style it like the Recent Items list. Is there a way to access the icons, ie if the item on the list is an Account than a folder appears next to it? I have found where the image is stored but its appears as one larger image with all the icons(contact, opportunity, etc.) in it. Any ideas?

*werewolf**werewolf*

That is in fact how icons in Salesforce.com work -- it's one big image and they use a CSS offset to show just a little piece of it.  That way the browser requests and caches just one big image rather than a whole bunch of little ones.  It's actually fairly common.

 

You can use that big image and the CSS offsets too.  Just use Firebug's inspector, mouse over one of those icons, and see the CSS in the area.  Note that there's no guarantee that those icons won't change suddenly and mess you up though, so be forewarned about that.

AdyAdy

Hi,

 

I would suggest a similar approach, but slightly modified.

 

Use CSS classname directly which is used  by Salesforce. For example, 'personaccountMru' is the className used for Person Account in recent items.

 

Example Code:

<div class="mruItem">
<a href="#" class="personaccountMru">
<img title="Account" class="mruIcon" alt="Account" src="/s.gif" />
Sample Account
</a>
</div>

 

For remaining objects too, you can easily get the class names using firebug or anyother developer tool..  :)

 

Have fun

Iqbal HIqbal H
I understand this solution but my question is not only specific to the Account object. I will be having different objects data in recent items. In this case how I can show the icons with respective to the object. If you not clear the question please let me know