Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Salesforce CRM Admin Cookbook

You're reading from   Salesforce CRM Admin Cookbook Solutions to help you implement, configure, and customize your business applications with Salesforce CRM and Lightning Experience

Arrow left icon
Product type Paperback
Published in Dec 2017
Publisher
ISBN-13 9781788625517
Length 358 pages
Edition 2nd Edition
Concepts
Arrow right icon
Author (1):
Arrow left icon
Paul Goodey Paul Goodey
Author Profile Icon Paul Goodey
Paul Goodey
Arrow right icon
View More author details
Toc

Table of Contents (9) Chapters Close

Preface 1. Making a Picture Paint a Thousand Words... 2. Salesforce CRM's Home Page is Where the Heart is... FREE CHAPTER 3. Automating Work with Salesforce CRM 4. Improving Data Quality in Salesforce CRM 5. Implementing Approval Processes 6. Productivity Tools for Superusers and Advanced Administration 7. Extending Lightning Experience Record Pages 8. Building a Search-First-Before-You-Create Lightning Component

Displaying Case Priority flags with Salesforce images and a formula field

The use of particular colors to represent certain states has become common place throughout the world. Red generally conveys danger and, in the ubiquitous traffic light signal, red means stop.

Continuing with the theme of traffic signal colors, and the use of red for stop, green for go, and yellow for proceed with caution, we can see how these colors can be used to represent statuses and to flag or highlight a current state or situation graphically.

Salesforce CRM contains images for red, yellow, and green flags.

In this recipe, we will display an image derived by a formula field that shows whether the Case Priority is high, medium, or low.

How to do it...

Carry out the following steps to create a formula field to display Salesforce images to graphically show the priority of case records:

  1. Click on the Setup gear icon in the top right-hand of the main Home page, as shown in the following screenshot:
  1. Click the Setup option, as shown in the following screenshot:
  1. Navigate to the Case customization setup page, by clicking the following: Objects and Fields | Object Manager | Case | Fields and Relationships.

Locate the Fields & Relationships section on the right of the page.

  1. Click New.

We will be presented with the Step 1. Choose the field type page.

  1. Select the Formula option.
  2. Click Next.

We will be presented with the Step 2. Choose output type page.

  1. Type Priority Graphic in the Field Label text box.
  2. Click on the Field Name. When clicking out of the Field Label text box, the Field Name is automatically filled with the value Priority_Graphic.
  3. Set the Formula Return Type as Text.
  4. Click Next.

We will be presented with the Step 3. Enter formula page.

  1. Paste the following code:
/*********************************************************** 

Priority Graphic for the Case, for High, Medium or Low. 

For high priority cases a red flag is displayed; for medium an orange is shown and for a low a green flag is shown. 

***********************************************************/ 

IMAGE  

(  

 IF( ISPICKVAL(Priority,"Low"), 

   "/img/samples/flag_green.gif",  

     IF( ISPICKVAL(Priority,"Medium"), 
       "/img/samples/flag_yellow.gif",  
         "/img/samples/flag_red.gif"  
       )  
       ), 
       "", 15, 15  
)
  1. Optionally, enter the following in the Description field:
Field to display an image according to whether the Case Priority is Low, Medium, or High 
  1. Optionally, enter the following in the Help Text field:
Field to display an image according to whether the Case Priority is Low, Medium, or High 
  1. In the Blank Field Handling section, select the option Treat blank fields.
  2. Click Next, as shown in the following screenshot:

We will be presented with the Step 4. Establish field-level security page.

  1. 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 field-level security.
  2. Click Next.

We will be presented with the Step 5. Add to page layouts page.

  1. 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.
  2. Finally, click Save.

How it works...

The case record formula field graphic is dynamically generated based on the selected priority value and appears on both case detail and edit pages.

You can see what this looks like when the case record Priority is set to Low in the following screenshot:

You can see what this looks like when the case record Priority is set to Medium in the following screenshot:

You can see what this looks like when the case record Priority is set to High in the following screenshot:

There's more...

The Priority Graphic formula image field is not only shown when the record is being viewed or edited but can also be seen when you include the field in a list view.

Formula fields containing an image can also be sorted in the list view.

You can see what this looks like within a list view when the list of case records are either High, Medium, or Low for the PRIORITY GRAPHIC column, as shown in the following screenshot:

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime