Salesforce Optimizer
Table Of Content
- Key Features of Salesforce Optimizer
- Running a Scan with Salesforce Optimizer
- Improve Org Performance with Salesforce Optimizer
- Use Case: Improving Org Performance
Salesforce Optimizer is a powerful, free tool available in the Lightning Experience app for Professional, Enterprise, Performance, Unlimited, and Developer Editions. It helps you identify potential issues in your Salesforce org by providing detailed insights across more than 50 metrics. These insights cover everything from storage, fields, and custom code to custom layouts for objects, reports, and dashboards. With its user-friendly interface, Salesforce Optimizer ensures your Salesforce organization stays clean, efficient, and well-maintained. It can be run in both the sandbox and production instances, making it an essential tool for developers and administrators alike.
Key Features of Salesforce Optimizer
Salesforce Optimizer offers a range of features that make it an indispensable tool for Salesforce admins and developers:
1. Organized List of Findings
Salesforce Optimizer organizes its findings in a list that is sorted by type, level of effort, and status. This helps administrators and developers quickly prioritize which issues to tackle first. The list can be filtered to focus on the most critical aspects, whether they are related to storage, fields, automation, or user experience.
Example: If Salesforce Optimizer identifies that there are too many unused fields in your org, the findings might be sorted as follows:
- Type: Field Optimization
- Level of Effort: Low
- Status: Needs Attention
This helps admins know where to start their clean-up process.
See also: Salesforce CPQ Specialist Exam Questions with Answers 2024
2. Field and Page Layout Clean-Up
Optimizer scans all the custom fields and page layouts in your Salesforce org to identify those that may no longer be in use. Fields that are not populated with data or are rarely used can be marked for removal, and page layouts with redundant fields can be streamlined.
Example: Let’s say Salesforce Optimizer identifies that the “Customer Since” field is never populated across most records. The report will show this under “Field Usage” and suggest removing or consolidating that field to improve system performance.
Code Snippet Example:
apexCopy code// A simple check to identify unused fields in Salesforce using SOQL
List<Account> accounts = [SELECT Id, Name, Customer_Since__c FROM Account WHERE Customer_Since__c = NULL];
System.debug('Found ' + accounts.size() + ' accounts with an unused field.');
// A simple check to identify unused fields in Salesforce using SOQL
List<Account> accounts = [SELECT Id, Name, Customer_Since__c FROM Account WHERE Customer_Since__c = NULL];
System.debug('Found ' + accounts.size() + ' accounts with an unused field.');
Explanation:
This Apex code queries the Account object to find records where the Customer_Since__c field is empty. It then logs the count of such records, helping to identify unused fields that can be removed or updated for better performance.
3. Recommendations for New Features
Salesforce Optimizer doesn’t just identify problems; it also recommends new features to improve your org. These recommendations are based on Salesforce’s yearly updates and help your org stay current with the latest tools and technologies, enhancing user experience and functionality.
Example: Optimizer might recommend switching to the Einstein Analytics platform or using Salesforce Flow for automation instead of classic workflow rules. The report might suggest enabling My Domain if it hasn’t been activated yet to allow for a better and more secure user experience.
See also: How to Change Custom Button Color in Salesforce?
4. Smooth Transition from Classic to Lightning
For orgs transitioning from Salesforce Classic to Lightning Experience, Salesforce Optimizer provides valuable reports that help streamline this move. Optimizer flags areas that need attention or adjustment, such as unsupported features or layouts that do not align with the Lightning design system.
Example: If you have a custom page layout in Classic that isn’t compatible with Lightning, Optimizer will flag it as needing an update. It may also suggest adjusting list views and custom buttons to align with Lightning’s capabilities.
Code Snippet Example:
// Example of Lightning Experience compatibility check using Apex
if (UserInfo.getUiTheme() == 'Theme4d') {
System.debug('The org is using Lightning Experience.');
} else {
System.debug('The org is using Salesforce Classic.');
}
Explanation:
This code checks the UserInfo.getUiTheme() method to determine if the current Salesforce org is using Lightning Experience (Theme4d
). Based on the result, it logs whether the org is on Lightning or Classic, which helps understand compatibility during the transition.
5. Field Usage Analysis
Optimizer scans for objects with a large number of fields, especially those that are unused or underutilized, which can impact performance. It flags objects with more than 350 fields, and the analysis helps admins determine whether those fields are still needed, ultimately improving org performance.
Example: If an object like Opportunity has 400 fields, Optimizer will flag it for review. You can then analyze the usage of each field and remove or consolidate those that are redundant.
Code Snippet Example:
// Query to find Opportunity records with many fields populated
List<Opportunity> opps = [SELECT Id, Name, StageName, Amount, CloseDate FROM Opportunity];
System.debug('Found ' + opps.size() + ' opportunities with key fields populated.');
Explanation:
This query selects key fields from the Opportunity object. The result shows how many opportunities have important fields populated, helping identify whether excessive fields exist, potentially causing performance issues that Salesforce Optimizer can flag.
See also: How to Disable CommandButton After First Click in VF?
6. Automation Impact Analysis
Salesforce Optimizer checks for excessive automation that could be slowing down the org. It flags objects where workflows, process builders, and Apex triggers are heavily used, which could lead to performance issues, especially if too many automation processes run simultaneously.
Example: If the Lead object has multiple workflows and an Apex trigger, Optimizer will suggest consolidating or revising the workflows and triggers to prevent hitting Apex limits or causing slow user experiences.
Code Snippet Example:
// Example of checking for active workflows on the Lead object
List<Workflow> workflows = [SELECT Id, Name FROM Workflow WHERE TableName = 'Lead'];
System.debug('Found ' + workflows.size() + ' workflows for the Lead object.');
Explanation:
This code queries the Workflow object to find all active workflows associated with the Lead object. The result is logged, helping to pinpoint whether too many workflows are running, which could hinder system performance.
7. Apex Trigger Analysis
Optimizer also identifies objects that have multiple Apex triggers. Multiple triggers on the same object can cause issues when they try to execute at the same time, leading to hitting Apex governor limits. Salesforce Optimizer will flag these triggers and recommend consolidating them to optimize performance.
Example: If multiple triggers are written for an object like Account, Salesforce Optimizer will suggest consolidating the logic into fewer triggers to prevent limit violations and improve performance.
Code Snippet Example:
// A simple check to identify triggers on Account object
List<ApexTrigger> triggers = [SELECT Name FROM ApexTrigger WHERE TableName = 'Account'];
System.debug('Found ' + triggers.size() + ' triggers for Account object.');
Explanation:
This code checks for all triggers associated with the Account object using a query on the ApexTrigger object. It then logs the total number of triggers, helping admins identify redundant or conflicting triggers that might need consolidation.
See also: How to Register for Salesforce Admin Certification?
8. My Domain Customization Check
Salesforce Optimizer flags whether the My Domain customization has been activated in your org. My Domain is essential for customizing Salesforce features and enabling secure login mechanisms. If it’s not activated, Optimizer will alert you to enable it for better security and to unlock more customization features.
Example: If My Domain isn’t activated in your org, Optimizer will show this as an issue and guide you to enable it to benefit from improved security features and enhanced customizations.
Code Snippet Example:
// Check if My Domain is activated in the org
if (Domain.getCurrentDomain() == null) {
System.debug('My Domain is not activated.');
} else {
System.debug('My Domain is activated.');
}
Explanation:
This Apex code checks whether My Domain is activated by using the Domain.getCurrentDomain() method. If the result is null
, it means My Domain hasn’t been activated, and the system logs a message to help administrators take necessary actions.
See also: How to use Salesforce Einstein AI in Sales Cloud?
Running a Scan with Salesforce Optimizer
Running a scan with Salesforce Optimizer is a straightforward process. Here’s a step-by-step guide to help you get started:
- In Setup: Type “Optimizer” in the quick find box.
- Allow Access: Click “Allow Access” to authorize the Optimizer to analyze your org.
- Save and Close: Once authorized, click “Save and Close”.
- Open Optimizer: Click “Open Optimizer” to launch the app within your org.
- Run Optimizer: Click “Run Optimizer” to begin the scan.
- View Findings: Once the scan is completed, you can view the list of findings, which will be sorted by their status.
Improve Org Performance with Salesforce Optimizer
Salesforce Optimizer not only identifies areas that need clean-up but also provides valuable insights to improve your org’s performance. Here are some key ways it helps:
- Excess Fields: The Optimizer flags objects with more than 350 fields. By analyzing the Field Usage row, users can identify which fields are populated and determine which ones are useful to keep.
- Automation Impact: It flags objects with too much automation, such as workflows, processes, or Apex triggers, which can negatively affect user experience and org performance.
- Apex Trigger Analysis: The Optimizer identifies objects that have multiple Apex triggers, which can cause you to hit Apex limits. This can significantly degrade performance, especially when processing large volumes of data.
- My Domain Customization: If you haven’t activated the My Domain customization, the Optimizer will flag this as well. My Domain is essential for customizing and securing your Salesforce org, and it’s a necessary step for enabling several other features.
See also: How Can I Troubleshoot DataKit Connect API Deployment Issues?
Use Case: Improving Org Performance
Let’s consider a scenario where the performance of your org is slowing down, especially when users are working on prospect data. To understand what needs improvement, you can run a scan through Salesforce Optimizer.
Solution: By running the scan, the Salesforce Optimizer will provide a detailed report on all areas affecting performance, including issues related to storage, fields, custom code, automation, and more.
Reason: The Optimizer’s insights help identify specific areas of improvement. For instance, it might flag objects with too many fields or automation running unnecessarily, allowing admins and developers to take targeted actions to address these issues.
Conclusion
In conclusion, the Salesforce Optimizer plays a crucial role in maintaining the efficiency of your Salesforce org. By providing deep insights into over 50 metrics and offering recommendations for clean-up and improvements, it empowers admins and developers to ensure their systems run smoothly. Whether you’re transitioning from Classic to Lightning, managing custom fields, or dealing with automation, the Salesforce Optimizer is a tool that helps keep your org at its best, offering actionable solutions for ongoing improvements.
By regularly using the Salesforce Optimizer, you’ll ensure your Salesforce environment remains lean, efficient, and user-friendly.