Loading

Mark Salesforce Sales Account Inactive if No Opportunity for X Days

Date de publication: Sep 24, 2026
Description

To automatically deactivate accounts with no recent opportunity activity, implement a Scheduled Flow to update the account status based on custom time thresholds.

To track the account's status, you can create a status picklist field on the Account object with two values: Active and Inactive. Else, you can create a checkbox field.

Résolution

Step 1: Create a Roll-Up Summary Field

On the Account object, create a Roll-Up Summary Field that shows the most recent Close Date of the Opportunity where Stage equals Closed Won, using the MAX option. Set the Field to Aggregate to Close Date.

Roll-up Summary Field configuration on the Account object, aggregating Opportunity Close Date using the MAX option

Step 2: Create a Formula Field

Create a number formula field (0 decimal places) on the Account object that calculates days since the account's most recent Closed Won opportunity. If no Closed Won opportunity exists, it falls back to days since the account was created.

IF(
ISBLANK(Most_Recent_Closed_Date__c),
TODAY() - DATEVALUE(CreatedDate),
TODAY() - Most_Recent_Closed_Date__c
)

Step 3: Create a Scheduled Flow

Create a Scheduled Flow to run daily. Set the criteria: Closed_Won_Opp_Since__c greater than 180 AND Account Status not equal to Inactive. Set the Start Date, Start Time, and Frequency as preferred.

Scheduled Flow setup screen for selecting the Account object as the flow

Scheduled Flow schedule settings showing Start Date, Start Time, and daily Frequency  

Step 4: Update the Account Record

Add an Update Records element in the flow to set the Account Status field to Inactive for records matching the criteria.

 Flow Update Records element setting the Account Status field to Inactive 

Result:
This Scheduled Flow runs daily and updates any Account with no Closed Won opportunity in the last 180 days to Inactive.

Numéro d’article de la base de connaissances

000393490

 
Chargement
Salesforce Help | Article