Using AI to Revolutionize Data Quality in Salesforce

Bill Appleton
6 min readDec 1, 2023

Metazoa publishes Org Management applications in the Salesforce ecosystem. Our Snapshot product removes technical debt, generates compliance documentation, and optimizes security permissions. Our technical debt tools look at the relationships between assets, when they were created, and the frequency of use. Our compliance documentation pulls information from the Metadata and Tooling API to create a wide variety of reports that help administrators visualize org complexity. Our security tools display and edit permissions to help Salesforce administrators discover and repair security problems.

The advent of Artificial Intelligence (AI) has dramatically enhanced these capabilities. Most technical debt reports are quantitative in nature. The report might show how much an asset is being used or when it was last used. But with AI, we can discover assets that violate corporate guidelines, break government regulations, or breach security policies. What’s more, AI can also be used to rewrite the asset and correct the problem. Salesforce administrators have always been concerned with data quality, and now AI provides them with an exciting new tool to address this issue in a fundamental manner. This capability introduces an entirely new qualitative dimension to org management.

Our new prompt engineering platform Metadata Studio is designed to create complex prompts with grounding data and few-shot learning. Then we use Prompt Automation to apply that prompt to the entire Salesforce org. This kind of massive data and metadata transformation can utterly rebuild an org from the ground up with better documentation, fewer problems, and higher quality assets. Salesforce administrators can also have interactive discussions about the org with our new administrative thinking partner Intelligent Search. This white paper explores this exciting qualitative revolution in Org Management with practical examples and links to brief movies showing these tools in action.

Org Documentation

Snapshot implements over 100 reports that help visualize org complexity. These reports identify hidden problems, simplify technical debt removal, and streamline security optimization. Key reports include Data Dictionary, Metadata Dictionary, Impact Analysis, and Code Quality.

But now AI enables incredible new opportunities to improve data quality and generate detailed documentation. Here is a link to a short movie that adds a description field to every node in every Flow in an entire org. First, the prompt is developed in Metadata Studio with few-shot learning. Next, we use prompt automation to apply these changes to every Flow in the org. Lastly, we switch over to Snapshot’s best-of-breed release management toolset and update the Flows in a sandbox:

Here is another use of AI for org documentation. In this case we create an Apex Class Dictionary that documents the class name, public properties, public methods, and external integrations for every Apex Class in the org:

Other documentation use cases for AI include:

  • Apex Class Comments
  • Apex Class Dictionary
  • Apex Class Functional Specification
  • Custom Field Compliance Group
  • Custom Field Help Text
  • Custom Field Description
  • Custom Field Business Status
  • Flow Functional Specification
  • Account and Opportunity Descriptions
  • Create Solutions from Support Cases

Technical Debt Removal

Snapshot provides the premier suite of tools for org cleanup and optimization. Snapshot can interactively detect and remove technical debt using the Data and Metadata API. Major applications include Forgotten Assets, Field Usage, Picklist Usage, Stale Reports & Dashboards, and Inactive User Cleanup.

But now AI is removing entirely new kinds of technical debt from the org. An example will help. Snapshot has existing reports to find Email Templates that have not been used recently or cannot be invoked by any other asset. But now with AI, we can search the org for Email Templates that are poorly written, contain grammatical errors, or violate the corporate style guide. Here is a short movie that shows Metadata Studio classifying all the Email Templates in an org:

Here is another example where Metadata Studio is used to analyze the Role Hierarchy and then generate XML to fix the problems:

Other technical debt use cases for AI include:

  • Apex Class Quality
  • Apex Class Size Reduction
  • Apex Class Functional Spec
  • Analyze Assignment Rules for Best Practices
  • Analyze Auto Response Rules for Best Practices
  • Analyze Duplicate Rules for Best Practices
  • Analyze Escalation Rules for Best Practices
  • Analyze Matching Rules for Best Practices
  • Analyze Moderation Rules for Best Practices
  • Analyze Role Hierarchy for Best Practices
  • Analyze Email Template Style

Security Optimization

Snapshot takes a deep dive into optimizing profiles and permission sets. The upcoming transition to base profiles will be much simpler with these tools. Applications include Profiles and Permission Sets, Permission Assignments, Merging Similar Profiles, Bulk Editing Permissions, and Folder Sharing Security.

But now with AI, our security and optimization capabilities have reached a new level. Here is an example. We were working with a customer who had 50 Validation Rules on the Opportunity Object. She was worried that there might be conflicts, problems, and duplicate functionality. We selected the rules in our administrative thinking partner and Intelligent Search generated a complete report on the various conflicts and even provided metadata XML to fix the problem:

Here is another example. This movie shows Metadata Studio generating detailed security classification and compliance group information for Custom Fields:

Another important use case is to categorize Apex Classes with respect to corporate security policies. Other security optimization use cases for AI include:

  • Analyze Apex Class Code Quality
  • Analyze Apex Class Code Security
  • Security Policy Analysis
  • Document Flow Best Practices
  • Profile Unusual Permissions
  • Permission Set Unusual Permissions
  • Analyze Validation Rules for Conflicts
  • Analyze Custom Field Compliance
  • Create Custom Field Description
  • Custom Field Security Classification
  • Create Custom Field with Description
  • Document Workflow Rules with Report

Compliance

Salesforce orgs must comply with important government regulations such as GDPR, COPPA, PCI, and HIPAA. Salesforce administrators can use AI to scan various data and metadata assets and check for compliance with these regulations. There are also Custom Fields that need to be populated with this information to ensure proper documentation.

The video below shows our administrative thinking partner Intelligent Search looking for GDPR problems and repairing them:

Conclusion

This white paper discusses the org quality revolution enabled by our administrative thinking partner Intelligent Search and our prompt engineering platform Metadata Studio. Salesforce administrators can conduct massive audits of their org and uncover quality problems, security vulnerabilities, missing documentation, regulatory violations, and more. In many cases problems can be automatically repaired, and data quality can be improved. These new capabilities constitute an incredible new addition to the Snapshot toolset.

--

--

Bill Appleton

Bill is an expert on smart clients and API services. He is currently the CTO at Metazoa where he works on the Snapshot Org Management application.