Carry out the following steps to create a formula field to display custom images that will reference the dollar image that was uploaded in the Getting ready section for this recipe:
- Click on the Setup gear icon in the top right-hand of the main Home page, as shown in the following screenshot:
- Click the Setup option, as shown in the following screenshot:
- Navigate to the Account customization setup page, by clicking the following: Objects and Fields | Object Manager | Account | Fields and Relationships.
Locate the Fields & Relationships section on the right of the page.
- Click New.
We will be presented with the Step 1. Choose the field type page.
- Select the Formula option, as shown in the following screenshot:
- Click Next.
We will be presented with the Step 2. Choose output type page.
- Type Account Revenue Graphic in the Field Label text box.
- Click on the Field Name. When clicking out of the Field Label text box the Field Name is automatically filled with the value Account_Revenue_Graphic.
- Set the Formula Return Type as Text.
- Click Next.
We will be presented with the Step 3. Enter formula page.
- Paste the following code in the formula edit box (as shown in the next image):
Remember to replace the URL shown with the URL from your Salesforce organization.
/********************************************************
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/1505987107000/money_dollar", "$", 16, 16),"")
&
IF( AnnualRevenue > 499999, IMAGE("/resource/1505987107000/money_dollar", "$", 16, 16),"")
&
IF( AnnualRevenue > 999999, IMAGE("/resource/1505987107000/money_dollar", "$", 16, 16),"")
&
IF( AnnualRevenue > 1999999, IMAGE("/resource/1505987107000/money_dollar", "$", 16, 16),"")
&
IF( AnnualRevenue > 4999999, IMAGE("/resource/1505987107000/money_dollar", "$", 16, 16),"")
- Optionally, enter the following in the Description field:
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
- Optionally, enter the following in the Help Text field:
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
- In the Blank Field Handling section, select the option Treat blank fields.
- Click Next, as shown in the following screenshot:
We will be presented with the Step 4. Establish field-level security page.
- Select the profiles to which you want to grant read access to this field via field-level security. The field will be hidden from all profiles if you do not add it to the field-level security.
- Click Next.
We will be presented with the Step 5. Add to page layouts page.
- Select the page layouts that should include this field. The field will be added as the last field in the first two column section of these page layouts. The field will not appear on any pages if you do not select a layout.
- Click Save.