The independent daily for Salesforce admins, developers and architects

Curated by Abhinav (opens in a new tab)

Recommended

Fixing Data in a before-save Flow instead of blocking users with Validation Rules (opens in a new tab)

You will learn how a before-save Record-Triggered Flow can correct a field value before a Validation Rule evaluates it, so users are not stopped by errors.

Why read this

You will also see when a Validation Rule should stay and how to make it less disruptive.

Validation Rule

  • Checks the value as entered
  • Blocks the save with an error
  • User must fix the value by hand

Before-save flow

  • Corrects the value before the check
  • Record saves with no error
  • Works for UI, API and Data Loader
Validation Rule blocks the save, while a before-save flow corrects the value first

The author opens with a sales manager whose reps kept personal spreadsheets because repeated validation errors made Salesforce slow to use. He argues that some Validation Rules can be replaced by logic that corrects the data instead of rejecting it.

A Record-Triggered Flow set to Fast Field Updates runs before the record is saved, ahead of Apex before triggers and Validation Rules. A corrected value is therefore what the Validation Rule checks, so the user sees no error. The same applies to every source that saves the record, including the UI, the API and Data Loader.

As an example, a rule requiring the Website field on Account to start with http or https can be replaced by a flow. The flow uses a formula resource that prefixes https:// when needed, then an Assignment element sets the field back on $Record. No Update Records element is needed, and the author advises testing in a sandbox and deactivating the rule while keeping its formula in the description. Other candidates include forcing uppercase codes, stripping dashes from tax IDs and deriving a region from a country.

Where the correct value cannot be inferred, as with a loss reason on a Closed Lost opportunity, the rule should stay but be made less painful. The author suggests showing the field only when relevant with Dynamic Forms, marking it required on the page, placing the error on the field, and scoping the formula with ISCHANGED(StageName).

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

Worth reading?

Recommended

Build a win-back review queue for Closed Lost Opportunities with a scheduled Flow (opens in a new tab)

You will learn how to add a loss reason and revisit date to lost Opportunities, have a Scheduled Flow create follow-up Tasks on those dates, and keep lost deals linked to any later win.

Why read this

The approach needs no Apex.

  1. Require a loss reason on Closed Lost
  2. Set Revisit_On__c with a Record-Triggered Flow
  3. Scheduled Flow runs daily on revisit date
  4. Create a Task assigned to the owner
  5. Route inactive owners to a queue or manager
How a Closed Lost Opportunity moves from lost deal to a daily revisit Task

The author argues that Opportunities marked Closed Lost fall out of pipeline reports and are rarely revisited, so lost deals return only by chance. He proposes a declarative setup that turns them into a review queue.

The setup adds two Custom Fields on Opportunity, Loss_Reason__c as a picklist and Revisit_On__c as a date. A Validation Rule requires a loss reason when the stage is Closed Lost. A Record-Triggered Flow sets the revisit date, with a default of 12 months after the close date that can vary by reason.

A Schedule-Triggered Flow runs daily on Opportunities that are Closed Lost and whose revisit date is today. It creates a Task for each record, assigned to the owner, with a subject, the activity date and a description containing the reason and amount. Inactive owners will cause failures, so the author suggests routing those records to a queue or manager with a Decision element. Before activating the flow, he recommends running a SOQL query to preview the next 30 days of revisits.

The author also suggests a lookup field, Original_Opportunity__c, to link a new Opportunity to the lost one when a deal returns. He warns against reopening old records or deleting Closed Lost ones, since that erases the history needed to measure how many lost deals come back and after how long. A second query groups won deals by the loss reason of their original Opportunity to test this.

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

Worth reading?

Writing clearer prompts for agents when you administer Salesforce (opens in a new tab)

You will learn eight writing principles for prompting an agent on admin work, and see a weak prompt rewritten into a strong one for a Validation Rule.

Why read this

The advice applies to any agent request you make.

Joshua Birk argues that prompting an agent is a writing skill rather than a form of engineering, and that admins can apply the communication habits they already have. He notes that a good prompt is usually three to six plain-language sentences that name the exact objects, fields and Flows by API name, explain the business reason, and state the output wanted and the guardrails. A one-line prompt tends to cost several rounds of clarification, while a few extra sentences up front save them.

The article then sets out eight lessons: know your audience, lead with the goal, be specific, give context and explain why, define the output format, show examples, use plain language, and set constraints. Each comes with an admin example, such as naming the team size so the agent pitches its answer correctly, or pasting an existing Validation Rule so the agent follows its naming pattern. Constraints such as working only in a sandbox or not touching active Flows are written into the prompt from the start.

To show the lessons together, Birk rewrites a vague request to create a close-reason Validation Rule into a detailed prompt covering the object, field, error message, naming convention, length limit and a no-deploy instruction. He closes by saying that one prompt rarely produces a finished solution, so admins should plan follow-up prompts, and he points to Trailhead modules and a GitHub kit of 100 admin prompts.

Read the original at Salesforce Admins Blog (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?

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?