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 SalesForce.com Icons Available for Use, see this sample:
** 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("https://johanmilis2-developer-edition--c.ap1.content.force.com/servlet/servlet.FileDownload?file=01590000000JAFy","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 https://johanmilis2-developer-edition--c.ap1.content.force.com/servlet/servlet.FileDownload?file=01590000000JAFy 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 https://c.na3.content.force.com/servlet/servlet.ImageServer?id=015500000028BXr&oid=00D300000000SHq&lastMod=1448149254000 - 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)
Publisher: Salesforce Labs
Blog last updated: 30 Mar 2016
Post a Comment