Case Study
Travel and Hospitality Company Optimizes Apex Classes
Apex Limits and Technical Debt
- Apex Limits: Approaching the 6MB limit for unpackaged Apex code, restricting future development.
- Technical Debt: Accumulation of poorly written code, duplicate methods, and inadequate testing.
- Performance Issues: Apex Triggers invoking too many Classes and Flows
- Code Quality: Inconsistent code quality leading to bugs and security vulnerabilities.
- Visibility: Lack of clear visibility into Apex Class dependencies and unused code.
- Testing Gaps: Insufficient code coverage and a need for more robust testing strategies.
Apex Class and Method Management
The company turned to Metazoa Snapshot, a comprehensive Salesforce org management platform, to address their Apex code challenges. Metazoa Snapshot provided a suite of tools and reports that enabled the company to gain control over their Apex environment. Key Metazoa Snapshot features utilized:
- Forgotten Assets Report: Identified unused Apex Classes, unused methods, and duplicate methods for decommissioning or consolidation.
- Apex Code Quality Report: Leveraged PMD static code analysis to identify code quality issues and potential security vulnerabilities. Automated AI code fixes.
- Code Coverage Report: Monitored code coverage to ensure adequate testing and identify areas needing improvement.
- Org Health Scan Report: Flagged Apex Classes with excessive duplicate lines, those not recently executed, and potential trigger-related issues.
- Profiles and Permissions Sets Report: Identified Apex Classes not enabled in any Profile or Permission Set, highlighting potential security risks.
- Impact Analysis Report: Provided comprehensive dependency analysis to understand how Apex Classes are invoked and what other assets they reference.
- Smart Deploy Interface: Tested deletions of Apex Classes to confirm they were not in use before permanent removal.
Implementation and Results
- Comprehensive Analysis: They ran the Forgotten Assets and Apex Code Quality reports to gain a clear understanding of their Apex code base.
- Code Cleanup: Based on the reports, they decommissioned unused Apex Classes and Methods, consolidated duplicate code, and addressed code quality issues identified by the AI-assisted Apex Code Quality Report.
- Improved Testing: They used the Code Coverage Report to identify areas with insufficient test coverage and implemented more robust Test Methods.
- Ongoing Monitoring: They scheduled regular Org Health Scans to proactively identify potential issues and maintain a healthy Apex environment.
- Managed Packages: Began a strategic migration of some functionality to Managed Packages to alleviate the Apex Limits problem.
Time and Cost Savings
- Reduced Apex Code Size: Decommissioned unused code and consolidated duplicate methods, reducing their Apex code footprint by 15% and freeing up valuable space for future development.
- Improved Code Quality: Addressed code quality issues, resulting in a 20% reduction in bugs and a more stable Salesforce environment.
- Enhanced Performance: Optimized Apex Triggers and improved code efficiency, leading to a 10% improvement in overall Salesforce performance.
- Reduced Technical Debt: Proactively addressed technical debt, reducing maintenance costs by 12%.
- Increased Developer Productivity: Gained better visibility into Apex dependencies and code quality, enabling developers to work more efficiently and effectively.
Testing Scope and Reported Outcomes
The project focused on Apex, and each tool answered a different question:
- Impact Analysis Report: showed how each Apex Class is invoked and what each class references, so reviewers could judge the regression risk of a change and focus testing on the affected assets.
- Code Coverage Report: showed where Apex test coverage was thin, which guided the new Test Methods.
- Scheduled Org Health Scans: flagged duplicate lines, classes not recently executed, and trigger issues for follow-up after the cleanup.
These tools analyze metadata and Apex tests. They do not run user interface regression tests, and the outcomes above come from Apex cleanup and Apex testing. That Apex work is the basis for the reported 15% reduction in Apex code size, 20% fewer bugs, and 10% improvement in overall Salesforce performance.
Conclusion
The travel and hospitality company’s success story demonstrates the power of Metazoa Snapshot in optimizing Salesforce orgs, reducing technical debt, and ensuring continued scalability. By leveraging Metazoa Snapshot’s comprehensive suite of tools, organizations can gain control over their Apex code, improve code quality, and drive significant time and cost savings. For companies facing Apex limits, technical debt, or performance challenges in their Salesforce environments, Metazoa Snapshot offers a powerful and effective solution.
Learn more about how Metazoa Snapshot can help your organization!