Salesforce Data Quality Audit via SOQL
Salesforce action: ExecuteSOQLQuery. Weekly flow runs SOQL queries to find records with missing required fields (e.g., Contacts without email, Accounts without industry), compiles a data quality scorecard, and distributes via email and Teams.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
This flow runs a weekly automated audit of Salesforce data quality by executing SOQL queries to identify records with missing required fields. It compiles the results into an HTML scorecard and distributes it via email and a Teams channel post, giving IT admins and sales teams visibility into CRM hygiene issues.
Use Case
Data quality degrades over time as records are created without complete information. This flow automates the detection of common gaps — such as Contacts missing email addresses or Accounts missing industry classification — and delivers a recurring scorecard so teams can take corrective action before data issues compound.
Flow Architecture
Weekly Recurrence
RecurrenceFires every Monday at 8:00 AM ET.
Init varTeamsGroupId
Initialize VariableLoads Teams Group ID from the flowlibs_TeamsGroupId environment variable.
Init varTeamsChannelId
Initialize VariableLoads Teams Channel ID from the flowlibs_TeamsChannelId environment variable.
Init varRecipientEmail
Initialize VariableLoads the report recipient email from the flowlibs_DataQualityRecipientEmail environment variable.
Init varContactQuery
Initialize VariableConfigurable SOQL query to find Contacts missing an Email.
Init varAccountQuery
Initialize VariableConfigurable SOQL query to find Accounts missing an Industry.
Init varReportHtml
Initialize VariableEmpty string used as the accumulator for the report HTML. Steps 1-6 run in parallel.
Query Contacts Missing Email
Salesforce ExecuteSOQLQueryRuns the configured SOQL to return Contacts where Email is null.
Query Accounts Missing Industry
Salesforce ExecuteSOQLQueryRuns the configured SOQL to return Accounts where Industry is null. Runs in parallel with the Contact query.
Compose Contact Count
ComposeCounts the records returned by the Contacts SOQL query.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_TeamsGroupId | String | <configure> | Teams Team (Group) ID where the scorecard will be posted. Set per tenant. |
| flowlibs_TeamsChannelId | String | <configure> | Teams Channel ID where the scorecard will be posted. Set per tenant. |
| flowlibs_DataQualityRecipientEmail | String | admin@contoso.com | Email address (or semicolon-separated list) for the weekly data quality report. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Salesforce | shared_salesforce | ExecuteSOQLQuery (Contacts missing Email) ExecuteSOQLQuery (Accounts missing Industry) |
| Office 365 Outlook | shared_office365 | SendEmailV2 |
| Microsoft Teams | shared_teams | PostMessageToConversation |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Add more data quality checks
- Add a new Initialize Variable action with your SOQL query (e.g., SELECT Id, Name FROM Opportunity WHERE StageName = null LIMIT 200), add a Salesforce ExecuteSOQLQuery action referencing the variable, add a Compose action to count the results, then update the Build Scorecard HTML Compose expression to include a new table row for your check.
- Change the schedule
- Edit the Weekly Recurrence trigger to adjust the frequency, day, or time the audit runs.
- Change report recipients
- Update the flowlibs_DataQualityRecipientEmail environment variable value in the solution settings to redirect the report without editing the flow.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Result counting
Counts records returned by the SOQL query.
EXPR.02Status indicator
Conditional status label per check based on whether the count is greater than zero.
EXPR.03Total issues
Sums all individual issue counts for the scorecard summary.
EXPR.04Date stamp
Current date used in the report header and email subject.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.