Skip to content

Finding stale opportunities in Salesforce: fields, SOQL and false positives

Updated 6 min readFor sales operations and RevOps owners running pipeline hygiene

No single Salesforce field says an opportunity is stale. Useful signals are a past CloseDate on an open deal, time since LastStageChangeDate, LastActivityDate, PushCount and HasOverdueTask, and each detects a different problem. LastModifiedDate is a poor signal, because any user edit resets it. Build a review queue that shows which signal fired for each deal, and let the owner decide what happens next.

Stale is several conditions wearing one name

A sales manager who asks for stale deals may mean deals nobody is working, deals whose dates are fiction, or deals stuck at a stage for too long. These need different fixes. A past close date is a hygiene problem that takes the owner one minute to correct. A deal parked in Negotiation for four months is a coaching conversation. A deal with no logged activity may be well run by someone who does not log calls.

Combine these into one flag and nobody can act on it, and reps learn to clear it by editing the record. I would keep the signals separate all the way through to the person reading the list.

Field on OpportunityWhat it tells youHow it misleads
CloseDate before today, while openThe date on the record is no longer trueSays nothing about whether the deal is alive
LastStageChangeDateHow long the deal has sat at this stageBlank for deals that never changed stage; long cycles may be normal
LastActivityDateLatest logged task, event, call or emailWork outside Salesforce is invisible; future-dated items can skew it
PushCountCalendar months the close date has moved outA single large push counts for more than several small ones; may be hidden
HasOverdueTaskSomeone promised a follow-up and missed itOnly as good as the team’s task discipline
LastModifiedDateA user last created or changed the recordAny edit resets it; says nothing about the customer

Record dates are a trap

First attempts tend to reach for LastModifiedDate, because it’s on every object. Salesforce documents that it changes when a user creates or updates a record, while SystemModstamp also moves when automated processes update it. So a rep who corrects a typo in the description makes a dormant deal look fresh, and a bulk update by an admin can do the same to thousands of deals. Use SystemModstamp for an integration’s delta load. It says nothing about the customer relationship.

LastActivityDate is closer to the question but has its own conditions. Salesforce Help warns that future-dated activities can yield negative values in days-since formulas, so a meeting booked for next month can register as activity in the future. Treat negative results as a separate category, and decide whether a scheduled future meeting means the deal is alive. It often does.

For time in stage, Salesforce’s own suggested formula falls back to CreatedDate when LastStageChangeDate is blank. Use the same fallback. Without it, a deal that was never moved from its first stage disappears from your check, and those are often the deals you were looking for.

A queue query that keeps the signals apart

Pull a broad population once and compute the signals in your application, or in whichever layer builds the list. A query with one long OR gives you the right rows but hides why each came back, so include the raw fields and label each row afterwards. I’ve used a 30-day activity window here as a placeholder for your own. Salesforce documents that LAST_N_DAYS:n covers records from n + 1 days ago up to the current day, so check off-by-one results against a report before you argue about them.

Check who can see PushCount. Salesforce allows the field to be controlled in opportunity list views and Pipeline Inspection, so a query for it may fail or come back empty depending on the org and the person. For activity detail beyond the rollup fields, query Task on WhatId, the polymorphic Related To ID, using the ID set from the first query. Filter on IsClosed instead of a list of status names, since Salesforce sets IsClosed from the Status picklist and admins can customize that picklist.

SELECT Id, Name, OwnerId, StageName, Amount, CloseDate,
       CreatedDate, LastStageChangeDate, LastActivityDate,
       PushCount, HasOverdueTask
FROM Opportunity
WHERE IsClosed = false
  AND OwnerId IN :teamOwnerIds
  AND ( CloseDate < TODAY
        OR LastActivityDate = null
        OR LastActivityDate < LAST_N_DAYS:30
        OR HasOverdueTask = true )
ORDER BY Amount DESC NULLS LAST

-- In your application: days_in_stage = today - (LastStageChangeDate or CreatedDate)
-- Label each row with every signal that fired.

SELECT WhatId, Subject, ActivityDate, Status
FROM Task
WHERE WhatId IN :opportunityIds AND IsClosed = false

Set thresholds from your own stage durations

Thirty days is a guess, and the wrong guess produces either an empty list or a list that gets ignored. Use your won deals as the reference, since they show how long healthy progress takes. For each stage, measure how long won deals spent there from OpportunityHistory, then use a high percentile as the bar for that stage and segment.

Synthetic example: for a fictional mid-market team, won deals spent a median of 12 days in Discovery and 21 in Proposal, with 90th percentiles of 30 and 55 days. A single 30-day rule would flag many healthy Proposal deals and catch Discovery only at the edge. A per-stage rule at the 90th percentile flags a Proposal deal at day 56 and a Discovery deal at day 31, close to how a manager thinks about them. Enterprise deals will need a different table.

To sort the list, rank by amount at risk divided by the time left in the period, and keep the ranking formula out of any claim about likelihood. A long-stalled deal at the top of the queue is a prompt to look at it. Nothing here gives you the probability it will close.

Discovery30 daysQualification40 daysProposal55 daysNegotiation45 daysFlat rule30 daysDiscovery30 daysQualification40 daysProposal55 daysNegotiation45 daysFlat rule30 days
Synthetic data for a fictional team. A flat 30-day rule fits only the first stage, so derive one threshold per stage from your own won deals.

Try the flag on the people it flags

Before you roll this out, take 20 flagged deals and 10 unflagged ones to the managers who own them, and ask whether each deserves a conversation. Record every disagreement. A deal paused until a known budget date is a fair false positive, and it raises a design question: does that context have a reliable field, or does it belong in the human review? A pause field needs an expiry too, or it turns into a permanent way to hide deals from the list.

Then look for the opposite failure, a deal the manager considers dead that nothing flagged. Usually a rep is still logging low-value activity on it. No timestamp will find those. Automated hygiene stops there and pipeline review starts.

I wouldn’t let the first version write anything. Pushing dates or closing deals automatically changes your history, muddying the forecast and win rate numbers you may want from the same data. Any automated close-out should be a separate decision, with a loss reason that lets you exclude it from win rate later.

Asking this in Nexatron

Stalled has several meanings. Where they give different results, we answer with one reading, say which, and offer the others in one click. An interactive answer that interprets the word carries an Interpreted label, and each answer shows the SOQL and the filters applied, so a manager can see which signal was used. A manager’s question runs under that manager’s sign-in and sees what Salesforce allows them to see.

We keep action tools apart from reading. Nobody gets an action scope by default, each one needs explicit consent, and write-back follows connector configuration your tenant admin manages. Roll this work out the same way. Start with the list, let people trust it, and only later ask whether any step should write back.

Bring three business questions

Explore your sources, definitions, and review criteria with our team. Please keep credentials and sensitive records out of the inquiry.