Increasingly on the Web, we find websites that use images of gold or silver stars to provide reviews and to rank the quality or usefulness of various products and services.
It has become universally accepted that one or no star equates to something very poor and a rating of five stars is seen to be excellent. By building an incremental number of images, we can create an associated image list of, say 1 to 5, that conveys a rating and ranking factor.
For this recipe, we are using a dollar image that will be repeated depending on the value of the Account Revenue amount.
Using the value entered in the standard Account Revenue field we will create a custom formula field to build a set of images, from one to five, whenever the Account Revenue amount meets a certain threshold criteria.
The thresholds that will formulate are:
Amounts less than $100,000 will have no images displayed.
We can use custom images that we have either created ourselves or obtained from an external source and store them in the Salesforce CRM application.
External images can be uploaded into Salesforce CRM by carrying out the following steps:
The image we have used here is a 16-by-16 pixel icon called money_dollar.png
available from famfamfam.com, shown as follows:
FamFamFam have provided various images from their "Silk Icons library" available under the Creative Commons Attribution 2.5 License at http://www.famfamfam.com/lab/icons/silk/.
money_dollar
.The Static Resources setup screen appears, shown as follows:
Static resources allow us to upload images that we can reference within Salesforce CRM, such as from formula fields, Visualforce pages, and so on. This reference is a Web URL and is formed as /resource/[UNIQUE ID]/money_dollar
where the [UNIQUE ID]
is a unique ID which is generated for every static resource and is unique throughout every Salesforce CRM system.
Now, to find the ID for the static resource uploaded above, carry out the following steps:
The URL that is generated is /resource/1360798680000/money_dollar
.
You will now need to make a note of the URL that is shown in your Salesforce organization. This URL is specified for the reference to the image in a custom formula field that is used in this recipe using the steps in the following section.
Now let's create the custom field that will reference the dollar image that was uploaded above:
Account Revenue Graphic
in the Field Label textbox.Account_Revenue_Graphic
./******************************************************** Begin the check for Annual Revenue value and set the following: Greater than (or equal to) 100,000 = One Dollar image Greater than (or equal to) 500,000 = Two Dollar image Greater than (or equal to) 1,000,000 = Three Dollar image Greater than (or equal to) 2,000,000 = Four Dollar image Greater than (or equal to) 5,000,000 = Five Dollar image *********************************************************/ IF( AnnualRevenue > 99999, IMAGE("/resource/1360798680000/money_dollar", "$", 16, 16),"") & IF( AnnualRevenue > 499999, IMAGE("/resource/1360798680000/money_dollar", "$", 16, 16),"") & IF( AnnualRevenue > 999999, IMAGE("/resource/1360798680000/money_dollar", "$", 16, 16),"") & IF( AnnualRevenue > 1999999, IMAGE("/resource/1360798680000/money_dollar", "$", 16, 16),"") & IF( AnnualRevenue > 4999999, IMAGE("/resource/1360798680000/money_dollar", "$", 16, 16),"")
Greater than (or equal to) 100,000 = One Dollar image Greater than (or equal to) 500,000 = Two Dollar image Greater than (or equal to) 1,000,000 = Three Dollar image Greater than (or equal to) 2,000,000 = Four Dollar image Greater than (or equal to) 5,000,000 = Five Dollar image
1 Dollar image = 100,000 or more 2 Dollar images = 500,000 or more 3 Dollar images = 1,000,000 or more 4 Dollar images = 2,000,000 or more 5 Dollar images = 5,000,000 or more
The formula field graphic is dynamically generated based on the annual revenue value and the rendered image appears on the Account Detail page.
You can see what this looks like when the Annual Revenue is set to $1,000,000 in the following screenshot:
You can see what this looks like when the Annual Revenue is set to $6,000,000 in the following screenshot:
18.226.172.200