Wednesday, March 30, 2016

Graphics Pack for Salesforce

In many cases, we would like to display a value as image, so this will catch user attention better (make sure the image is located in proper area in page layout). With formula field, this should be not an issue, but sometimes, we just need to find a right image and upload it to a document folder.

Salesforce by default provide hundreds of icon, you can find it here Icons Available for Use, see this sample:
IF(Closed_Won_Amount__c>100000, IMAGE("/img/samples/stars_500.gif","5"), 
IF(Closed_Won_Amount__c>50000, IMAGE("/img/samples/stars_400.gif","4"), 
IF(Closed_Won_Amount__c>30000, IMAGE("/img/samples/stars_300.gif","3"), 
IF(Closed_Won_Amount__c>10000, IMAGE("/img/samples/stars_200.gif","2"), 


** Closed_Won_Amount__c is a roll up summary from Opportunity Amount.

But if standard images provided are not enough, you can download a package from AppExchange called Graphics Pack. This is free provided by Salesforce Labs. Once installed, you will get thousand of images in Document folders.

Click Graphics Pack Overview tab from Graphics Packs app menu to see list of the images provided by Graphics Pack. 'Graphics Pack' contains hundreds of images / icons that can be used in salesforce applications for tabs, image formulas, and Visualforce pages
- Additional graphics for image formulas
- Additional graphics for tabs
- Additional graphics for Visualforce pages

IF( NOT ISNULL(SLAExpirationDate__c), IF (SLAExpirationDate__c > Today(), IMAGE("","Over SLA"), IMAGE("/servlet/servlet.ImageServer?id=01590000000J9eb&oid=00D90000000H7oz","Not over SLA") ),"No SLA identified")

If you notice, in the 1st IMAGE() formula, I use full URL in a custom domain and 2nd formula with relative URL /servlet/servlet.ImageServer?id=01590000000J9eb&oid=00D90000000H7oz
I would suggest to use 2nd formula as best practice.

How to get the URL?
Open the image from document folder, right click the image and select "Open in new tab" if you use Google Chrome or similar menu using other web browser, get the URL and you will get something like this - You just need to copy after .com until before &lastMod, so it would be /servlet/servlet.ImageServer?id=015500000028BXr&oid=00D300000000SHq notice that it is similar with sample above in 2nd IMAGE() formula.

Type: AppExchange (Not Managed Package)

Paid/Free: Free

Publisher: Salesforce Labs



Version: 1.2.0

Blog last updated: 30 Mar 2016