Ever wanted to make your Salesforce records a bit more visual? We’ll walk you through how to set up a Campaign Response Indicator on standard Campaign records using Salesforce’s built-in features. From uploading static resources to creating custom fields and writing the formula, we’ll cover it all.
In this blog, we’ll walk you through how to create a formula field that shows an image based on the value of another field in an object. Sounds cool, right? For example, we’ll build a Campaign Response Indicator that gives you a quick visual cue on each Campaign record—so you can easily see which campaigns are crushing it, which ones are just okay, and which ones might need a little extra love.
Use of An Image Formula Field
An image formula field in Salesforce is a field that uses the standard Salesforce IMAGE function to display images based on the specific logic. This can be especially useful for displaying images or performance indicators directly on our UI/pages. Instead of scanning through text or numbers, users get a view of important details. In our case, we are using it to show different images for various levels of campaign performance, as mentioned below:
- High response image: This will show a successful campaign with a response rate of 50% or above.
- Medium response image: This will show an average campaign with a response rate between 20% and 49%.
- Low response image: This will show a low-performing campaign with a response rate below 20%.
Key Components of the Implementation
- Static Resources:
Static Resources are used to store the images (High, Medium and Low). We upload the images as static resources so that they can be referenced in the formula field. - Custom Field – Response Rate:
Response Rate is a numeric field (Response_Rate__c) that stores the campaign’s response rate percentage. It will basically be used for determining which image to display.
Implementation
Step 1: Log In and Access Setup
Log in to Salesforce org. Once logged in, click the gear icon in the top right corner and select Setup.
Step 2: Go to the Campaign Object
From the Setup, click on the Object Manager tab. In the Object Manager, search for and select Campaign.
Step 3: Create the Custom Field – ‘Response Rate’
- Go to Fields & Relationships:
On the Campaign object page, click Fields & Relationships. - Create a New Field:
Click New and select Number as the field type. It will capture the response rate. - Define Field Details:
Enter Response Rate as the Field Label. The Field Name will auto-populate as Response_Rate__c. - Set Field-Level Security and Add to Page Layouts:
Make sure that the field is visible to the required profiles and add it to the desired page layouts.
After completing the above steps, we now have a custom field on the Campaign object to store the response rate, which will be used by the formula field to determine which indicator to use.
Step 4: Upload Images as Static Resources
Now, we need to upload the images that will represent the campaign performance.
- Navigate to Static Resources:
In Setup, search for Static Resources in the Quick Find box and select it. - Upload the images:
- Click New.
- For each image, provide a unique resource name. In this blog, we will be using Low_response, Medium_response, and High_response.
- Set the Cache Control to Public.
- Upload the corresponding image file based on business requirements.
- Click Save and repeat for the remaining two images.
The screenshot below displays the Static Resources page with all three image resources successfully uploaded.
Step 5: Create the Image Formula Field ‘Campaign Response Indicator’
- Create a New Field on the Campaign Object:
In the Campaign object, go to Fields & Relationships and click New. Choose Formula as the field type, then click Next. - Define the Field Details:
Enter Campaign Response Indicator as the Field Label. The Field Name will automatically generate. Click Next. - Select the Return Type:
Choose Text as the return type because the IMAGE function returns an HTML string.
- Build the Formula:
In the formula editor, paste the following code:
Explanation:
- The formula checks the Response Rate field.
- If the response rate is 50% or higher, it will display the High response image.
- If it’s between 20% and 49%, it will display the Medium response image.
- If the response rate is below 20%, it will display the Low response image.
Check Syntax and Save the Formula Field:
Click Check Syntax to ensure there are no errors. Once validated, set the field-level security and add the field to the page layouts as required, then hit Save
Here’s a quick screenshot of the formula field editor, showing the formula we just talked about along with the Response Rate field in action.
Testing and Verifying Implementation
Once both the custom Response Rate field and the Campaign Response Indicator formula field are created now we will test it by the below steps:
1. Update Response Rates:
Navigate to Campaign records and update the percentage of the Response Rate field.
2. View the List View:
Go to a Campaign list view where the Campaign Response Indicator field is visible. We should see the appropriate image displayed next to each Campaign based on its response rate based on the images we specified in the static resource.
The screenshot below shows a list view with three campaigns, each displaying a different image corresponding to their response rates:
3. Detailed Record View:
Open a Campaign record to view the detailed page. Here, both the Response Rate and Campaign Response Indicator fields will be visible together.
The screenshot below demonstrates a single Campaign record with both fields displayed, allowing users to quickly check performance:
Benefits of Using Visual Indicators
- Improved Readability:
Visuals like images are much faster than text or numbers, and also, this allows for faster decision-making by just viewing images. - User Engagement:
A well-designed user interface can enhance user engagement. Employees are more likely to interact with a system that provides intuitive image-like feedback. - Efficiency in Monitoring:
With the Campaign Response Indicator, monitoring campaign performance becomes much more efficient. Managers can focus on strategic decisions rather than spending time sifting through data. - Customization:
Salesforce’s flexibility allows us to image indicators according to the organization’s specific needs. For instance, we can adjust the percentage, image sizes or use different images that align with business requirements.
Also Read – Type of exceptions in Salesforce
FAQs
1. Can we track formula fields in Salesforce?
No, Salesforce doesn’t let you track formula field changes using the regular Field History Tracking feature.
2. What is the image formula field salesforce?
An image formula field in Salesforce is just a regular formula field that uses the Image() function to show images based on some logic you define.
Conclusion
By using a simple formula field and a few static resources, you can now turn textual Salesforce record data into something much more visual and intuitive Salesforce records. Give it a try in your org and see how a using formula fields you can show images in Salesforce records.