8 Steps to Clean Up and Optimise your Salesforce Org
By Heather Black

Find out more about a technical debt centre, from Metazoa, how to understand where any problems may be and how to get on the right track to reducing the complexity of your Salesforce org.
What is ‘Technical Debt’ and how can Metazoa help your Salesforce ROI?
Salesforce orgs can become unmanageably complex over time. The complexity might stem from corporate mergers and acquisitions, poor change and release management practices, failed development projects, or disruptive administrative turnover. This problem tends to be the most severe in the oldest and largest Salesforce orgs. Most orgs get more complex every day. Without proper maintenance, they will eventually become unusable. Technical debt can reduce the value of your investment in Salesforce and cause real financial pain. The negative effects of technical debt include:
- Slower performance and reduced agility
- More employees required to maintain org
- Lost sales due to outages and delays
- Delayed delivery of new projects
- Less efficient sales and marketing spend
- Downstream impacts of poor data quality
- Additional time required to update org
Consider an org where Profiles, Page Layouts, and Custom Objects are being created with the Setup Menu at a linear rate. The number of total user permissions in the org will increase at an exponential rate. But when you consider the impact of other entangled assets like Custom Fields, Record Types, Custom Tabs, and Apex Classes, the overall complexity of the org will increase at an even higher rate than in this simple example.

This blog discusses what you can do with our new product to reduce the technical debt in your Salesforce org. Technical Debt Center features comprehensive reports that show where technical debt resides in the org. Deleting unnecessary assets is a great first step in simplifying your org and reducing complexity. Once you understand where the problems are, you will be on the right track to reducing the complexity of your Salesforce org.
Discovering Complexity
Technical Debt Center features a Change Impact Analysis report that can help you visualize the complexity of your org. Change Impact Analysis can be used to predict the impact of org changes and generate entity relationship diagrams. This report covers all 250 metadata types and over 1200 relationships. You can browse metadata relationships, visualize org dependencies, and debug deployment errors.

Unused Assets
There are several different metadata asset types that can end up being left behind because of Org configuration settings. For example, maybe the asset is not referenced by any other asset. This can happen with Groups, Queues, and Email Templates. Perhaps the asset is not assigned to any user.
This can happen with Profiles, Permission Sets, and Roles. In addition, assets can be forgotten because they were deactivated or hidden. This can happen with Workflows, Assignment Rules, Approval Processes, and Flows. There are analogous problems on the data side, where Fields and Picklist Values can be underutilized. Reports and Dashboards can also go stale. Admins should take advantage of the compliance information that Salesforce provides for each Custom Field.
This information includes the Description, Help Text, Business Status, Security Classification, and Compliance Group. Special attention should be given to the date the asset was created and last modified, and which admins were involved. Deleting all these unused assets is a great first step towards org cleanup and optimization.
Technical Debt Center has comprehensive reports that can discover and delete unused data and metadata. First off, the deployment toolset can be used to delete or restructure Metadata in production orgs and Sandboxes.
The Data Migration tools can be used to remove or migrate data as well. In particular. the Forgotten Assets report has individual algorithms to detect over 100 forgotten Metadata asset types. These unused assets can also be deleted with Smart Deploy. Here is a list of the reports specifically focused on Deleting Unused Assets.
- Field Usage– Discover and Delete unused Fields with Smart Deploy
- Picklist Usage– Discover and remove unused Picklist Values
- Forgotten Assets– Clean up over 100 Metadata Asset types with Smart Deploy
- Last Activity Date- Clean up stale Reports, Dashboards, and Email Templates.
Field Usage
Some of the Custom Fields in your Salesforce account are more important than others. Some are rarely used, others not at all. Some may be forgotten while others are perhaps no longer required. One way to measure usefulness is to look at fields that are empty. Another technique is to look for fields and picklists that contain default values. Fields that do not appear on any Page Layout should also attract suspicion. Lastly, the SOQL API provides powerful grouping and filtering services that can measure how distinct field values are. The more distinct the field values, the more the field is being used, versus fields with more uniform values, which contain lots of duplicate information.
Once this information has been gathered, judgement is required on a field-by-field basis to determine their usefulness. You may need to drill down and see why a field is more or less distinct. For example, Account Name, Phone, and Website will be almost 100% distinct, but Account Zip Code and State will be more uniform. Often you will discover that more uniform fields are mainly populated by empty or default values. That might point to a field that needs to be deleted, or perhaps that should be a required field. If most of the fields are no longer needed, then the entire object can go.

Picklist Usage
The only thing more complex than fields are picklists. First off, picklists are multiplexed by Record Types, and further complicated by controlling versus dependent picklists. Picklists will have a defined list of values, but they will likely have many other values that have been entered by hand over the years. What values should be on the defined list? What other values need to be remapped to one of the defined values? Which picklist items should be eliminated from the list entirely? Once again, looking at distinct versus uniform values will give you lots of information about how your Org is using picklists and which ones require cleanup.
The Tooling API can be used to determine when a Custom Field or Picklist was created and last modified. You can also retrieve the Salesforce username of the administrator that made these changes. This information should be factored into any decisions about the importance of the field. Perhaps field usage is low because the field was recently created. Fields and Picklists that were created long ago and have not been modified should be looked at carefully and perhaps slated for deletion.

Forgotten Assets
There are over 200 asset types currently handled by the Metadata API. These metadata assets describe all the customizations in your org. But this information can also be used to discover forgotten, hidden, and inactive assets. In some cases, an asset will not be enabled by any of the Profiles or Permission Sets in the org. In other cases, there will be no metadata references to the asset. Many metadata assets have an “active” or “visible” flag that can be checked. The Data API can also be used to find assets that have no assigned users. Here is a list of common problems that can be discovered:
- Groups not referenced by Custom Objects or Assignment Rules
- Roles, Profiles, and Permission Sets with no assigned users
- Custom Objects and Fields not referenced by other metadata assets
- Record Types, Custom Tabs, and Custom Applications that are not visible
- Web Links not referenced by Page Layouts or Home Page Components
- Inactive Rules: Workflow, Approval, Assignment, Moderation, Escalation

Stale Reports and Dashboards
Stale assets are properly connected to your Salesforce account, but they have not been used in a long time. Email Templates have a Times Used and Last Used Date field available from the Data API. Likewise, Reports have a Last Run Date. The Refresh Date for Dashboards can be calculated from the connected Reports. You will likely find Reports and Email Templates that have never been used, but be careful, because sometimes these objects are simply new, so be sure to also check the Created and Last Modified Dates.

Inactive Users
Once a User is created, they can be made inactive, but they cannot be deleted. Over time, orgs can end up with more inactive users than active ones. There are over 50 different ways that an inactive user can remain connected to a Salesforce org. Inactive users can still manage active users, receive system emails, remain team members, and serve as the running user for Dashboards and other important enterprise systems.
These zombie users complicate org management and software development. They also pose multiple security threats. Tracking down and removing all the connections between inactive users and the Salesforce org can be a very complicated process. The connections can be by username, user email, and user ID. The best practice is to identify these Users and either delete their connections to the org or replace them with an active user.
Many other problems are related to Users. We once worked with a customer that had over 100,000 User Roles. When the Role hierarchy changes, this triggers a Record- Level Security recalculation. As you can imagine, this customer’s org suffered from massive performance issues due to constant security recalculations. In this case, the answer was cleaning up the Role hierarchy and then reassigning all Users to the correct Role.
The User Connection Cleanup report can document all 50 different User connections to the org. This report can clean up inactive users by deleting junction records and reassigning assets to an active User. This report can also reassign User relationships to data records.

License Expense Management
Technical Debt Center has a License Expense Management report that covers Organization, Feature, Package, and Permission Set Licenses. The actual usage and cost of each license type can be compared. This information will give you a bird’s eye view of all your license expenditures and areas where usage is high, medium, or low. You can also discover Users that have the Permission to do something but not the License, or the License to do something but not the Permission. This information can help identify permission problems and pinpoint licenses that are not being used or cannot be used.

Summary
Salesforce has provided many powerful options for customizing an org and solving important business problems. But without proper management, a dynamic Salesforce org can become crippled with technical debt over time. But don’t worry! technical debt is a problem that can be fixed. Fortunately, the Metazoa’s Technical Debt Center can both find technical debt and fix the problems as well. Here is a link to Technical Debt Center on the AppExchange.
Download our free Ebook on tackling technical debt in your Salesforce org
Find out more about Metazoa or follow us on social:
- Website: https://www.metazoa.com
- Twitter: @metazoa4sf
- Facebook: https://www.facebook.com/metazoa4sf
- LinkedIn: https://www.linkedin.com/company/18493594/

Written By:
Subscribe To Our Weekly Top Tip Bulletin
Get Updates And Learn From The Best