<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: AninditaSFCode</title>
    <description>The latest articles on DEV Community by AninditaSFCode (@anigitsource).</description>
    <link>https://dev.to/anigitsource</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4211474%2F01cae8b2-6380-4963-bf59-9752fb55242c.png</url>
      <title>DEV Community: AninditaSFCode</title>
      <link>https://dev.to/anigitsource</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anigitsource"/>
    <language>en</language>
    <item>
      <title>SF Coach</title>
      <dc:creator>AninditaSFCode</dc:creator>
      <pubDate>Wed, 28 Oct 2026 04:45:01 +0000</pubDate>
      <link>https://dev.to/anigitsource/sf-coach-3pdh</link>
      <guid>https://dev.to/anigitsource/sf-coach-3pdh</guid>
      <description>&lt;p&gt;If you are preparing for a Salesforce developer job, you probably know the feeling. You read the notes, watch the videos, and then freeze when an interviewer asks you a real question. I wanted a way to practice that feels like a real conversation, so I built a practice coach for Salesforce developer interviews.&lt;/p&gt;

&lt;p&gt;It is called "SF COACH"&lt;/p&gt;

&lt;p&gt;What it does?&lt;br&gt;
SF Coach is a web app. You open it in your browser and talk to an AI coach. It has four ways to practice:&lt;br&gt;
1.Learn:- Ask the coach to explain a topic, such as triggers or database limits. You get a simple explanation, a short example, and a quick check question.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Scenario:-The coach makes up a realistic business problem, like a company that needs approvals for big discounts. You describe how you would build it, and the coach tells you what works and what could break.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Mock interview:--The coach asks you one question at a time, just like an interviewer. After each answer, it tells you what you did well, what you missed, and how a strong answer would sound. When you're done, you can get a scorecard that shows where you are strong and where you need work.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Code review:- Paste some Salesforce code, and the coach reviews it the way a senior developer would in a team check. It points out problems and suggests fixes.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can pick a topic too, such as Apex, Triggers, LWC, Testing, Security, or Architecture.&lt;/p&gt;

&lt;p&gt;Here is an optional approach to Connect your own Salesforce org.&lt;br&gt;
If you have a free Salesforce Developer account, you can connect it to SF Coach. &lt;br&gt;
Then the coach can look at your real objects and fields, so the scenarios feel like your own practice project. It can also read your own code for reviews.&lt;/p&gt;

&lt;p&gt;The connection is read-only. &lt;br&gt;
The coach can look, but it cannot change anything in your org.&lt;/p&gt;

&lt;p&gt;Who it is for--&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;People preparing for Salesforce Platform Developer I or II interviews&lt;/li&gt;
&lt;li&gt;Developers who want a patient practice partner they can use any time&lt;/li&gt;
&lt;li&gt;Anyone switching into Salesforce who wants to learn by doing&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What you need--&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A computer with Node.js installed&lt;/li&gt;
&lt;li&gt;An Anthropic API key (this is separate from the free Claude chat app, and it is paid per use)&lt;/li&gt;
&lt;li&gt;Optional: a Salesforce Developer Edition org&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Setup takes about ten minutes. The project's README has the steps.&lt;br&gt;
The coach is an AI. Check its answers against Salesforce's official documentation before you rely on them.&lt;br&gt;
Scorecards are not saved yet. Each session starts fresh.&lt;br&gt;
Sessions cost a small amount of API credit each time, depending on how long you chat.&lt;/p&gt;

&lt;p&gt;Whats my next plan on this-&lt;br&gt;
I plan to save scorecards over time, so you can see which topics you're improving on and which still need work.&lt;br&gt;
Below is the read.md file for you to go through and add you own anthropic key and get started with working with your live sf coach as you gear up for your SF interview.&lt;br&gt;
Give it a try../README.md‎&lt;br&gt;
Practice Salesforce Platform Developer interviews with a Claude-powered coach. &lt;br&gt;
It runs four modes: &lt;br&gt;
Learn, &lt;br&gt;
Scenario, &lt;br&gt;
Mock interview, and &lt;br&gt;
Code review. &lt;br&gt;
Optionally, it connects to a Salesforce Developer Edition org so scenarios use your real objects and code review can pull your own Apex classes. Org access is read-only.&lt;br&gt;
Setup&lt;br&gt;
bash&lt;br&gt;
cd sf-coach&lt;br&gt;
npm install&lt;br&gt;
cp .env.example .env&lt;/p&gt;

&lt;p&gt;Edit &lt;code&gt;.env&lt;/code&gt;:&lt;br&gt;
&lt;code&gt;ANTHROPIC_API_KEY&lt;/code&gt;: required for the coach.&lt;br&gt;
 &lt;code&gt;ANTHROPIC_MODEL&lt;/code&gt;: defaults to &lt;code&gt;claude-opus-5&lt;/code&gt;.&lt;br&gt;
 &lt;code&gt;SF_CLIENT_ID&lt;/code&gt; and &lt;code&gt;SF_CLIENT_SECRET&lt;/code&gt;: from the Connected App below. Optional---without them the &lt;strong&gt;coach runs without org access&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;SF_LOGIN_URL&lt;/code&gt;: &lt;code&gt;https://login.salesforce.com&lt;/code&gt; for Developer Edition orgs.
Keep &lt;code&gt;.env&lt;/code&gt; private. It is gitignored at the repository root.
## Create the Connected App (optional, for org access)&lt;/li&gt;
&lt;li&gt;In your Developer Edition org, open Setup and search for &lt;strong&gt;App Manager&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;New Connected App&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Set the callback URL to &lt;code&gt;http://localhost:3001/oauth/callback&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Enable &lt;strong&gt;OAuth Settings&lt;/strong&gt; and add the scopes &lt;strong&gt;Manage user data via APIs (api)&lt;/strong&gt; and &lt;strong&gt;Perform requests at any time (refresh_token, offline_access)&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Save, then wait a few minutes for Salesforce to activate the app.&lt;/li&gt;
&lt;li&gt;Copy the &lt;strong&gt;Consumer Key&lt;/strong&gt; and &lt;strong&gt;Consumer Secret&lt;/strong&gt; into &lt;code&gt;.env&lt;/code&gt;.
## Run
bash
npm run dev&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Open &lt;a href="http://localhost:3001" rel="noopener noreferrer"&gt;http://localhost:3001&lt;/a&gt;. The header shows &lt;strong&gt;Ready&lt;/strong&gt; once &lt;code&gt;ANTHROPIC_API_KEY&lt;/code&gt; is set. Click &lt;strong&gt;Connect org&lt;/strong&gt; in the side panel to sign in to Salesforce.&lt;/p&gt;

&lt;p&gt;For a production build:&lt;br&gt;
bash&lt;br&gt;
npm run build&lt;br&gt;
npm start&lt;/p&gt;

&lt;h2&gt;
  
  
  Notes
&lt;/h2&gt;

&lt;p&gt;Org tokens stay in server memory. Restarting the server disconnects the org.&lt;br&gt;
The org tools accept only single &lt;code&gt;SELECT&lt;/code&gt; queries and cannot modify data or deploy metadata.&lt;br&gt;
Scorecards are not saved between sessions yet.&lt;br&gt;
 I would love to hear what worked and what didn't. Leave a comment below.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Implementing a Modular Trigger Handler Framework in Apex for Enterprise Scale</title>
      <dc:creator>AninditaSFCode</dc:creator>
      <pubDate>Tue, 27 Oct 2026 17:33:41 +0000</pubDate>
      <link>https://dev.to/anigitsource/implementing-a-modular-trigger-handler-framework-in-apex-for-enterprise-scale-23og</link>
      <guid>https://dev.to/anigitsource/implementing-a-modular-trigger-handler-framework-in-apex-for-enterprise-scale-23og</guid>
      <description>&lt;p&gt;As Salesforce organizations grow, triggers frequently become messy, unmaintainable "spaghetti code." When multiple developers add logic directly to an object's triggers without a unified pattern, it leads to unpredictable execution order, severe recursion bugs, and unexpected governor limit breaches.&lt;/p&gt;

&lt;p&gt;In this guide, we will look at how to build a lightweight, object-oriented Trigger Handler framework that enforces the Single Responsibility Principle (SRP), controls execution order cleanly, and provides built-in recursion and bypass management for enterprise-scale orgs.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The Problem with Unstructured Triggers
In a standard unstructured setup, you might see multiple triggers on the same object (e.g., AccountTrigger1, AccountTrigger2) or a single monolithic trigger crammed with business logic, queries, and DML statements.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This causes three major bottlenecks:&lt;/p&gt;

&lt;p&gt;1.Unpredictable Execution Order&lt;br&gt;
Salesforce does not guarantee the order of execution between multiple triggers on the same sObject.&lt;/p&gt;

&lt;p&gt;Recursion Nightmares: Updates triggered by downstream automation can accidentally re-fire the same trigger infinitely.&lt;/p&gt;

&lt;p&gt;Difficult Unit Testing: Hardcoding business logic directly in triggers makes it nearly impossible to isolate code for testing without hitting unnecessary DML limits.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The Architectural Solution
To solve this, we can implement a Base Trigger Handler Pattern.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The One-Trigger-Per-Object Rule: Every sObject has exactly one trigger.&lt;/p&gt;

&lt;p&gt;Virtual Base Class: A reusable base class (TriggerHandler) manages trigger context (Trigger.isBefore, Trigger.isAfter, etc.), routing execution to specific lifecycle methods.&lt;/p&gt;

&lt;p&gt;Domain Handlers: Individual handler classes (AccountTriggerHandler) inherit from the base class and override only the methods they need (e.g., beforeInsert(), afterUpdate()).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Production-Ready Code Implementation
A. The Base Trigger Handler (TriggerHandler.cls)
This abstract/virtual base class routes trigger events and handles global bypass logic.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Apex&lt;br&gt;
public virtual class TriggerHandler {&lt;br&gt;
    private static Set bypassedHandlers = new Set();&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Virtual lifecycle methods to be overridden in domain handlers
@TestVisible protected virtual void beforeInsert() {}
@TestVisible protected virtual void afterInsert() {}
@TestVisible protected virtual void beforeUpdate() {}
@TestVisible protected virtual void afterUpdate() {}
@TestVisible protected virtual void beforeDelete() {}
@TestVisible protected virtual void afterDelete() {}
@TestVisible protected virtual void afterUnDelete() {}

public void run() {
    if (!validateRun()) return;

    switch on Trigger.operationType {
        when BEFORE_INSERT { this.beforeInsert(); }
        when AFTER_INSERT  { this.afterInsert(); }
        when BEFORE_UPDATE { this.beforeUpdate(); }
        when AFTER_UPDATE  { this.afterUpdate(); }
        when BEFORE_DELETE { this.beforeDelete(); }
        when AFTER_DELETE  { this.afterDelete(); }
        when AFTER_UNDELETE{ this.afterUnDelete(); }
    }
}

private Boolean validateRun() {
    String handlerName = String.valueOf(this).split(':')[0];
    return !bypassedHandlers.contains(handlerName) &amp;amp;&amp;amp; Trigger.isExecuting;
}

public static void bypass(String handlerName) { 
    bypassedHandlers.add(handlerName); 
}

public static void clearBypass(String handlerName) { 
    bypassedHandlers.remove(handlerName); 
}    
@TestVisible
public static void clearAllBypasses() {
    bypassedHandlers.clear();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;B. Domain Handler Implementation (AccountTriggerHandler.cls)&lt;br&gt;
Here is how clean your object-specific logic becomes. We can now notice how triggers no longer contain raw business logic—they delegate work to service or handler methods.&lt;/p&gt;

&lt;p&gt;Apex&lt;br&gt;
public with sharing class AccountTriggerHandler extends TriggerHandler {&lt;br&gt;
    protected override void beforeInsert() {&lt;br&gt;
        // Delegate domain logic to service classes&lt;br&gt;
        AccountService.normalizeBillingAddresses((List) Trigger.new);&lt;br&gt;
    }&lt;br&gt;
    protected override void afterUpdate() {&lt;br&gt;
        AccountService.syncRelatedContacts(&lt;br&gt;
            (List) Trigger.new, &lt;br&gt;
            (Map) Trigger.oldMap);&lt;br&gt;
    }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;C. The Single Dispatcher Trigger (AccountTrigger.trigger)&lt;br&gt;
Your actual database trigger file is now reduced to 3 clean lines of code.&lt;/p&gt;

&lt;p&gt;Apex&lt;br&gt;
trigger AccountTrigger on Account (before insert, after insert, before update, after update) {&lt;br&gt;
    new AccountTriggerHandler().run();&lt;br&gt;
}&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Key Enterprise Benefits
Easy Trigger Bypassing: When running batch jobs, data migrations, or complex integrations where triggers need to be skipped, you can easily turn them off dynamically:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Apex&lt;br&gt;
TriggerHandler.bypass('AccountTriggerHandler');&lt;br&gt;
// Perform bulk data operation...&lt;br&gt;
TriggerHandler.clearBypass('AccountTriggerHandler');&lt;br&gt;
Clean Separation of Concerns: Triggers only listen; handlers route; service classes execute business logic.&lt;/p&gt;

&lt;p&gt;Predictable Debugging: Stack traces become significantly easier to read because every execution flows through a standardized dispatch method.&lt;/p&gt;

&lt;p&gt;Conclusion---&lt;br&gt;
Adopting a modular trigger framework takes very little setup time, but it pays massive dividends as your Salesforce org scales. It keeps your code base clean, testable, and friendly for fellow developers collaborating on the same environment.&lt;/p&gt;

&lt;p&gt;Have you implemented a custom trigger framework in your org, or do you use a package framework like fflib? Let's discuss in the comments below!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
