Whenever a Lead record is updated, set the Lead Status to Working-Contacted.

Lead management is the heart of every successful sales process. But when teams update Lead records—such as assigning owners, updating phone numbers, or changing lead sources—they often forget to change the Lead Status. This can cause serious problems down the line: leads get lost in the pipeline, reporting becomes inaccurate, and sales reps lose track of follow-ups.

In this blog, we explore a simple but powerful Salesforce Apex trigger that automatically sets the Lead Status to “Working-Contacted” whenever a Lead record is updated. Whether you’re modifying a field manually or via automation, this ensures that your system always reflects the most up-to-date status of engagement.

The trigger runs in the before update context, which allows Salesforce to modify the record in memory before saving it—meaning no additional DML is needed.

🧠 Why This Trigger Matters


Setting Lead Status manually is one of the most common points of failure in the lead nurturing process. Sales reps may forget, skip, or mistime the status update, which leads to:

  • Pipeline confusion

  • Poor reporting and forecasting

  • Missed SLAs or delays in follow-up

  • Inaccurate segmentation for marketing automation

By enforcing a default Lead Status of “Working-Contacted” every time the record is updated, you reduce manual errors and keep your data aligned with actual engagement.

🔍 What You’ll Learn in This Blog


  • How to create a before update trigger on the Lead object

  • Why setting values in Trigger.new is efficient and bulk-safe

  • How to automate lead lifecycle tracking with minimal code

  • When and how to extend this logic for real-world use cases

  • Best practices for maintaining clean, scalable automation

This example is a great starting point for teams looking to standardize CRM hygiene without relying on users to manually update status fields.

🎯 Real-World Use Cases


  • Lead Assignment Automation: As leads get reassigned or enriched, this trigger ensures the status reflects active follow-up.

  • Marketing-Sales Handoff: Automatically marks marketing-qualified leads (MQLs) as “Working-Contacted” once touched by sales.

  • Call Center Data Updates: Even if agents only update a phone number or email, the system tracks that outreach has been attempted.

  • Third-party Integrations: External platforms updating leads will still trigger a status update inside Salesforce.

This simple trigger becomes a foundation for consistent pipeline reporting, improved visibility, and smarter workflows.

👨‍💻 Developer & Admin Tips


Let’s break down how it works:

  • The trigger listens for the before update event on the Lead object.

  • It loops through each record in Trigger.new.

  • For each Lead, it sets the Status field to "Working-Contacted".

  • Since this is done before the DML commit, no extra insert/update is required.

The logic is:

  • Bulk-safe: Designed to handle multiple leads in one transaction

  • No SOQL/DML inside the loop: Avoids hitting governor limits

  • Declarative-friendly: Can work alongside Flows and Validation Rules

You can extend the logic to:

  • Only set the status if it’s currently blank or not equal to “Closed”

  • Use a Custom Setting or Metadata type to configure default status values

  • Add logic to skip updates if a checkbox like “Do Not Contact” is checked

  • Log updates to a custom object for audit purposes

Testing suggestions:

  • Update one Lead and verify the status is set

  • Bulk update 50+ leads via Data Loader to ensure bulk safety

  • Update leads with status already set to something else to confirm override

  • Trigger updates via API or Flow to verify cross-source consistency

This is one of those automations that looks small—but quietly solves big problems.

Solution:

trigger LeadTrigger on Lead (before update) {
      if(Trigger.isBefore && Trigger.isUpdate) {
          for (Lead leadRec : Trigger.NEW) {
               leadRec.Status = ‘Working-Contacted’ ;
               }
      }

}

Want to Apply As Content Writer?

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart

Let's get you started!

Interested in writing Salesforce Content?

Fill in this form and we will get in touch with you :)