The independent daily for Salesforce admins, developers and architects

Curated by Abhinav (opens in a new tab)

Recommended

Staging an AI agent's Salesforce access in three permission levels (opens in a new tab)

You will learn a staged way to grant an AI agent access to Opportunity data: read first, then propose tasks, then write a few fields.

Why read this

You will also see how the staging exposes data gaps and undocumented exceptions before any record changes.

  1. Level 1: read Opportunity and activities
  2. Level 2: propose Tasks for the owner
  3. Level 3: write a few fields
The agent gains write access only after each lower level works

The author describes an AI agent that reviews Salesforce Opportunities with no activity for 30 days, checks recent interactions and prepares follow-up actions. The design question is what the agent is allowed to do, and the author splits this into three permission levels that the agent moves through only once the level below works.

At level 1 the agent only reads Opportunity, its activities and OpportunityHistory. It runs under its own integration user with a Permission Set limited to the objects and fields it needs, and any tool layer such as MCP exposes read tools only. Every query is logged with its filter. This level shows whether no movement is defined well, since LastActivityDate, stage changes in OpportunityHistory and LastModifiedDate give different lists, and LastModifiedDate also moves when a Flow, integration or bulk load touches a record.

At level 2 the agent proposes rather than edits, creating a Task for the Opportunity owner with the suggested next step, WhatId set to the Opportunity, OwnerId set to the owner and a subject prefix that marks it as agent-written. A person decides what happens. This level reveals exceptions, such as deals deliberately paused, which the agent cannot know unless they are stored in a field, and data gaps, such as calls logged outside Salesforce. The author suggests counting open Opportunities with no LastActivityDate and fixing the data before moving on.

At level 3 the agent writes a few fields, such as a next step or follow-up date, with field-level security keeping the rest read-only. Exceptions are encoded in the query, for example skipping records with a future resume date, and changes are tested in a sandbox with realistic data. Because the agent has its own user, LastModifiedById and field history separate its changes from people’s. The author’s point is that a wrong filter at level 3 corrupts every matching record at once, so the staging keeps mistakes cheap.

Read the original at dev.to (opens in a new tab)

Worth reading?

Recommended

Mining OpportunityHistory with pandas to see how sales really run before automating (opens in a new tab)

You will learn how to turn the OpportunityHistory object into an event log and use pandas to find stage variants, skipped stages, waiting times and single-person bottlenecks.

Why read this

You will also see what these findings should settle before an AI agent is given the sales process.

  1. Export OpportunityHistory as an event log
  2. Build stage variants and count rework
  3. Measure median wait between stages
  4. Count who moves the stages
The four analyses used to measure the real sales process from OpportunityHistory

The author argues that a documented sales process often differs from the one a company actually runs, and that an AI agent will faithfully follow whichever version it is given. Before automating, teams should measure the real process. Salesforce already records a row in OpportunityHistory whenever an opportunity’s stage, amount or close date changes, so no setup is needed. A SOQL query selecting the opportunity ID, stage, amount, close date, creation date and creator over the last 180 days can be exported to CSV and used as an event log.

The post then walks through four analyses in pandas. The first removes rows that are not real stage changes and counts the distinct stage paths, or variants, across opportunities; the documented process is usually one line, while the data usually shows many. The second flags opportunities that went back to an earlier stage and those that moved from creation to the last stage in two steps or fewer, which suggests the CRM was updated only at the end. The third calculates the median wait between each pair of stages to locate handoffs or approvals that happen outside the system. The fourth counts how many stage changes each user made, since one or two users moving most records suggests updates are being collected elsewhere and typed in.

The author stresses that these numbers show where the problems are, not why they occur. Each signal should prompt a question: which process is the real one, what the rep gains from updating the CRM, which area owns a slow handoff, and where the information actually lives. Answering these first prevents an agent from speeding up the wrong steps. The same approach can extend to orders, invoices and payments when the ERP lives in the same Salesforce org.

Read the original at dev.to (opens in a new tab)

Worth reading?

Recommended

Finding hidden duplicate accounts after a Salesforce Data migration (opens in a new tab)

You will learn how to normalise legacy keys, count duplicates in a spreadsheet and in SOQL, separate true duplicates from key collisions, and repoint child records before deleting a duplicate Account.

  1. Normalise the legacy key
  2. Count raw and normalised keys
  3. Classify each duplicate group
  4. Repoint child records
  5. Delete the duplicate
The duplicate clean-up sequence for migrated Accounts

Matching record counts after a migration can hide duplicates. Re-run loads, insert calls used where an upsert on an External ID was needed, and keys that differ only by case, spaces or leading zeros all leave duplicates behind. Salesforce duplicate and matching rules do not examine a legacy key unless a rule is built for it.

The article walks through normalising the key with spreadsheet formulas, counting raw and normalised keys, and classifying each group as unique, exact duplicate, hidden duplicate or key collision. A SOQL GROUP BY query with HAVING clause provides the same check inside the org, though it catches case differences only, not leading zeros or trailing spaces.

Before deleting anything, the author chooses a survivor, usually the Account with the most Contacts, and repoints Contacts, Opportunities and Cases to it with Data Loader or the Account merge operation. The checklist ends with marking the External ID field Unique so the next load cannot insert the same key twice.

Read the original at dev.to (opens in a new tab)

Worth reading?

Six practical Validation Rule patterns to improve data quality in Salesforce (opens in a new tab)

Readers will learn six ready-to-use Validation Rule formulas that prevent common data entry mistakes, along with best practices for writing clear field-level error messages.

  1. User enters or edits a record
  2. Validation Rule formula is evaluated
  3. Bad data is blocked with a clear error
  4. Error appears at the field level
How a Validation Rule stops bad data before it is saved, using the article's approach

The article outlines six Validation Rule patterns designed to catch frequent user errors without requiring Apex or Flow. These include preventing Closed Won Opportunities from missing amounts or close dates, blocking Cases with backdated open dates beyond a seven day window, and ensuring close dates never precede creation dates.

Additional patterns address picklist state management by stopping records from reverting to New once closed, unless a custom bypass permission is granted. The piece also requires a reason field when priority changes to High status, and locks amount fields during approval reviews to prevent revenue leakage.

Beyond the formulas, the author emphasizes error message hygiene. Rules should be named clearly, descriptions filled out for audits, and errors placed at the field level rather than the page header. Messages must instruct users on the correct action instead of simply stating an invalid value. The author notes that while Validation Rules stop immediate data issues, field level required attributes or Flow notifications may be better alternatives for certain workflows.

Read the original at dev.to (opens in a new tab)

Worth reading?

Recommended

Implementing email verification workflows in Salesforce beyond standard Validation Rules (opens in a new tab)

You will learn how to distinguish between email formatting checks and actual deliverability verification, and how to build a reliable workflow using Custom Fields, flows, and external APIs.

Why read this

The piece outlines trigger points, error handling, and monitoring metrics to maintain CRM data quality.

The article distinguishes between email validation, which enforces syntax through a Validation Rule, and email verification, which confirms domain existence, mail server configuration, and mailbox deliverability. Standard format checks cannot prevent bounces or identify disposable addresses.

It recommends placing verification at record creation, during field updates, or through bulk cleanup processes. A practical workflow involves creating a Custom Field, defining trigger events, calling an external verification service via API or managed package, and applying business rules to route verified, invalid, or risky addresses accordingly.

Developers are advised to handle inconclusive results gracefully, avoid redundant processing, maintain audit trails, and respect consent and privacy requirements. The author notes that while custom integrations offer flexibility, native applications can reduce maintenance overhead, and ongoing monitoring of bounce rates and verification metrics ensures the workflow actually improves data quality.

Read the original at dev.to (opens in a new tab)

Worth reading?

A practical workflow for cleaning Salesforce data before implementing AI (opens in a new tab)

Readers will learn a structured five-step process for auditing and cleaning Salesforce records before deploying artificial intelligence features.

Why read this

The piece explains how to automate ongoing data hygiene using standard administrative tools to prevent model failures.

The article argues that artificial intelligence initiatives in Salesforce consistently fail when trained on unclean data, emphasizing that pattern matching models amplify existing record errors rather than masking them. Common issues include duplicate contacts and leads, incomplete required fields, inconsistent Picklist values, and stale records that cause Agentforce assistants to route cases incorrectly or generate inaccurate summaries.

To address these problems, the author recommends running a comprehensive data audit before approving any artificial intelligence project. This involves generating reports on empty key fields, executing Duplicate Jobs, and manually sampling records to create a data health summary for leadership approval. The cleanup must follow a strict sequence starting with deduplication, followed by populating critical fields, standardizing formats through Validation Rules, archiving inactive records, and enforcing data entry standards at the source.

Sustainable data quality requires moving beyond one-time projects by implementing automated maintenance routines. The author suggests scheduling recurring Duplicate Jobs, distributing weekly exception reports to record owners, and tracking completeness metrics on a dashboard. Once real data ownership is established and the operational layer is secured, Salesforce artificial intelligence capabilities such as lead scoring and case classification can function reliably without undermining user adoption.

Read the original at dev.to (opens in a new tab)

Worth reading?