Today4 stories

The Daily Org

Spring '27Sandboxes 6 Feb 2027

Curated by Abhinav (opens in a new tab)

Vol. I · No. 49The independent daily for Salesforce admins, developers and architects4 stories

Must-readFlow and admin

Customizing the Case Send Email Action with Apex and declarative options (opens in a new tab)

You will learn when Predefined Field Values and formulas are enough for the Case Send Email action, and how to use a QuickActionDefaultsHandler with Custom Metadata Types to set sender and recipients dynamically.

Why read this

You will also see the precedence and design trade-offs to weigh before writing Apex.

Declarative

  • Fixed sender address
  • Subject from a formula
  • Recipient from Case Contact

Apex handler

  • Sender chosen by region
  • Dynamic CC and BCC
  • Routing from related records
Declarative defaults suit simple cases, while Apex suits complex routing

The article explains that Salesforce Service Cloud’s standard Send Email Quick Action in the Case Feed lets agents compose and send emails from a Case, with default values for recipients, sender and subject. It argues that many requirements, such as a fixed sender, a subject built from the Case Number or a recipient taken from the Case Contact, can be met declaratively through Predefined Field Values and formula expressions on the action’s configuration page.

Where logic becomes more complex, such as choosing a sender by Case region, adding an Account Relationship Manager to CC or a Compliance Team to BCC for certain Case types, the author proposes Apex using the QuickAction.QuickActionDefaultsHandler interface. The example stores region-to-sender mappings in a Custom Metadata Type called CaseRegionSetting__mdt, with a From Address field and records for North America, Europe, Asia Pacific and India. The handler class is then registered under Setup, Support Settings, as the Default Handler for Email Action.

The architectural section sets out when to choose each approach, and notes that the Apex handler takes precedence over predefined values, so conflicting defaults should be avoided. It recommends keeping addresses and routing rules in Custom Metadata rather than hardcoding them, checking that the From Address is an eligible sender identity such as a verified Org-Wide Email Address, and avoiding SOQL inside loops because the handler runs when the composer initializes.

Read the original at SalesforceCodex (opens in a new tab)

Worth reading?

RecommendedAgentforce and AI

Testing least-privilege write access for a Salesforce AI agent in five layers (opens in a new tab)

You will learn a five-layer test plan for checking what a Salesforce AI agent can write, including negative tests and a prompt-injection scenario.

Why read this

You will also see why authorization must be enforced in the action rather than in the model prompt.

  1. Load Case as the agent user
  2. Check verified contact and status
  3. Reject if any check fails
  4. Update Case only when all pass
Each write must pass server-side checks before Salesforce data changes

The article opens with the SalesBleed research, in which a poisoned lead manipulated Agentforce. It argues that giving an AI agent write access creates a new security boundary between natural-language instructions and business data, and that a valid Permission Set does not authorize every change. It proposes testing five layers: identity, actions, fields, records and execution.

It then sets out a reference least-privilege matrix for a support agent that may move Cases from New to Working. The agent should run as a dedicated user with object and field limits, change only the Status field, act only on records linked to a verified customer, and be denied uncontrolled system-mode writes. The author labels this an illustrative test asset rather than measured results.

Six pre-production tests follow: verifying the runtime identity, auditing every write path including Apex, Flows and OAuth scopes, confirming field and record restrictions, validating business rules, and comparing record state before and after each test. The article suggests release criteria such as zero unauthorized CRM writes across negative tests and traceable authorization for every successful write.

The adversarial section simulates a lead carrying fake administrator instructions. The article argues that prompt injection must be blocked at the action boundary by checking identity, target record, fields and transitions server-side. A short pseudocode example shows a policy check using a verified contact ID. The piece closes with notes on Summer ’26 user-mode defaults for Apex database operations and a final checklist.

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

Worth reading?

Integration

Using Named Credentials to keep secrets out of Apex callout code (opens in a new tab)

You will learn how to pair an External Credential with a Named Credential, grant access through a Permission Set, and call an external API from Apex without hardcoding endpoints or secrets.

Why read this

The post also flags the callout limits that still apply and the Permission Set step that is easy to miss.

  1. Create the External Credential
  2. Create the Named Credential
  3. Grant access with a Permission Set
  4. Call it from Apex with callout:
Setup order for a Named Credential and its access, then the Apex callout

Hardcoding endpoint URLs and credentials in Apex or Custom Settings is a common and risky pattern for external integrations. Named Credentials bundle the base URL, authentication scheme and credentials into one definition that Apex refers to by name, so secrets stay out of source code and debug logs.

Setup takes two records, created in order. First, an External Credential holds the authentication protocol and identity details, including the token endpoint for OAuth flows. Second, a Named Credential points at the base URL and links to that External Credential. A Permission Set must then grant users access to the External Credential, a step the author says is often skipped and produces errors that do not explain the cause.

In Apex, the callout uses the callout: prefix with the credential name followed by the resource path, with no URL string or Authorization header in the code. Test classes still need a mock, but only have to assert against the named endpoint. The post notes that Named Credentials do not raise the 100-callout-per-transaction limit or the 120-second timeout, so batching or queueing is still needed for heavy use.

The author also covers rotating secrets by editing a single record rather than redeploying code, and configuring a credential per user where actions should be attributed to individuals rather than the org. Retrofitting an existing integration means creating the two records, replacing hardcoded endpoints with callout: references and deleting stored secrets.

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

Worth reading?

Flow and admin

Choosing between Flow Builder and Apex by automation density and testing (opens in a new tab)

You will learn how Flow and Apex differ in order of execution, limits and testing, and how Salesforce's Architecture Center maps automation density levels to the tool to use.

Why read this

You will also see where testing requirements currently differ between the two.

  1. Low density: Under 15 automations: Record-Triggered Flow
  2. Medium density: 15 to 30 automations: Flow plus invocable Apex
  3. High density: Over 30 automations: Apex
Automation density levels, from low to high, and the tool the Architecture Center suggests for each

The article compares Salesforce Flow with Apex for building business automation. Flow lets Salesforce Admins build automations without code, with a gentler learning curve, while Apex is a Java-like language that needs developer resources but has no functional limits beyond what a developer can write. The author notes that Flow Builder is still powerful for agent-era work.

Order of execution is a key consideration: Flows run before Apex triggers, and Apex triggers can run multiple times in a single transaction. The author suggests architecting workflows with both points in mind so behavior matches expectations.

The Salesforce Architecture Center groups objects into three automation density levels. Low density (under 15 automations, 1 to 200 records, one downstream DML operation) suits Record-Triggered Flow. Medium density (15 to 30 automations, 200 to 2,000 records, 2 to 4 downstream DML operations) calls for a hybrid of Flow and invocable Apex. High density (over 30 automations, over 2,000 records, more than five downstream DML operations) points to Apex.

On limitations and testing, before-save flows have more restrictions than after-save flows, and some tasks such as complex list processing need Apex. Apex must pass test coverage before deployment, while Flow currently does not, though the recently introduced Flow Test Mode is a first step toward structured flow testing. The author advises testing flows and building in a sandbox before production.

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

Worth reading?