The independent daily for Salesforce admins, developers and architects

Curated by Abhinav (opens in a new tab)

Check what else runs on an object before shipping AI-Generated changes (opens in a new tab)

You will learn a repeatable way to list the active Flows, Validation Rules and triggers on an object using the Salesforce CLI and pandas, so a reviewer can see what a change will collide with before it ships.

  1. Export active Flows with SOQL
  2. Export active Validation Rules
  3. Export active triggers via Tooling API
  4. Filter the exports by object in pandas
  5. Attach the tables to the ticket for review
The article's method for finding existing automation on an object before shipping an AI-generated change

The article argues that an AI-drafted Flow, Apex class or Validation Rule must be checked against everything else already running on the same object. Before review, the author suggests finding that automation first, since a clean-looking change can clash with an existing rule, loop with another Flow, or overwrite a field a batch expects to be empty.

The method uses the Salesforce CLI to export active Flows with a SOQL query on FlowDefinitionView, and active Validation Rules and triggers through the Tooling API. Triggers are matched on their object, while Flows have no dedicated object field, so the author scans API name, label and description instead, which is imperfect but faster than opening every Flow. A short pandas script then filters the three exports for a chosen object such as Opportunity and produces a review agenda.

The author adds that managed package automation will also show up in these results. Managed items cannot be edited but can still fire after a change, so they belong in a separate list. The tables should be attached to the ticket so the next reviewer does not have to rerun the queries.

The piece also proposes three test cases a model often skips: a record that must be blocked with a clear message, a record that must pass even when a field arrives late, and the same change run by a non-admin user. It lists reasons to wait a day before shipping, such as a missing description, tests that check coverage rather than the business rule, or a field the model invented. The article is practical and short, and the queries are the main takeaway.

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

Worth reading?

Four rules for constraining an AI agent that deploys to Salesforce (opens in a new tab)

You will learn a design for letting an AI agent handle Salesforce deploys safely: a fixed action menu, approval gates, org-checked results and logged, capped runs.

Why read this

The reader comes away with a concrete set of guardrails to consider.

  1. Plan reviewed and approved
  2. Check-only validation in production
  3. Human clicks to deploy
  4. Org queried to verify results
The agent works through three human approval gates before production changes

The author argues that the slow part of a Salesforce deploy is usually assembling the package, choosing tests and target org, and interpreting failures, which are language tasks suited to a model. Deployment itself is not, so the agent is designed around four rules.

First, the model never touches an org. It receives no credentials, shell or sf CLI access, only a fixed menu of actions such as validate, deploy, run tests, query and retrieve. Code checks its parameters and performs the action with the sf CLI and git.

Second, humans approve at three points: the plan, which shows components, target org, tests and risk; a changed plan, when a retry alters components or scope; and production, where a check-only validation runs before a human deploys, including destructive changes. Sandbox steps run automatically while everything stays green. Third, success is verified by querying the org, not taken from the model, and the summary is written from that evidence table. Fourth, every run is logged, with a cost cap and a limit of three retries.

The model’s role is limited to turning a request into a reviewable plan and turning a failed deploy into a plain explanation, such as a test that does not set a new checkbox and so trips a new Validation Rule.

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

Worth reading?

Must-read

Advanced PySpark patterns for batch data transforms in Data 360 (opens in a new tab)

Readers will learn how to structure, test, and deploy PySpark Code Extension scripts for complex batch transformations in Data 360.

Why read this

The piece demonstrates three production-ready patterns for hierarchical rollups, JSON event parsing, and machine learning scoring.

  1. Author PySpark script locally using Python SDK
  2. Validate script locally via SF CLI command
  3. Deploy packaged extension to Data 360 org
  4. Execute managed Spark job on demand or schedule
The end-to-end workflow for developing custom batch transforms in Data 360

The article introduces Data 360 Code Extensions as a mechanism to run custom PySpark logic against Data Lake Objects and Data Model Objects within an isolated compute environment. It outlines the full development lifecycle, detailing how engineers use the Salesforce Command Line Interface to validate scripts locally against a sampled dataset before packaging and deploying them to the platform.

The first example implements an iterative loop to calculate total tree revenue across variable-depth account hierarchies by continuously joining frontier records until convergence. The second example provides a reusable helper to parse and explode JSON array columns containing batched session events into individual rows for downstream analytics.

The third example demonstrates how to bundle a serialized scikit-learn classifier and its categorical feature grid to score leads efficiently via a broadcast join. The post concludes by reviewing managed Spark constraints around memory and timeouts, while noting that the transformed outputs become queryable objects for Agentforce agents.

Read the original at Salesforce Developers Blog (opens in a new tab)

Worth reading?