Close Date Change Counter
Overview
This guide explains how to create a custom field in Salesforce to track modifications to an opportunity's close date, along with an automated flow to update the counter.
Prerequisites
- Salesforce Administrator permissions
- Access to the Opportunity object
Creating the Custom Field
Follow these steps to set up the tracking field:
- Navigate to Setup > Objects > Opportunity
- Click Fields & Relationships tab
- Select New button
- Choose Number data type
- Configure with these details:
- Field Label: Number of Closed Date Changes
- API Name: Number_of_Closed_Date_Changes
- Decimal Places: 0
- Default Value: 0
- Click Save
Creating the Record-Triggered Flow
Set up automation to increment the counter:
- Go to Setup > Process Automation > Flows
- Click New Flow
- Select Record-Triggered Flow template
- Enter flow details:
- Flow Name: Update Number of Closed Date Changes
- API Name: Update_Number_of_Closed_Date_Changes
- Object: Opportunity
- Trigger: Record is updated
- Add a Formula element:
- Name: Closed Date Changed
- Type: Boolean
- Expression:
{!Opportunity.CloseDate} != {!Opportunity.PriorCloseDate}
- Add an Assignment element:
- Variable: Number of Closed Date Changes
- Value:
{!IF(ISBLANK(Opportunity.Number_of_Closed_Date_Changes), 0, Opportunity.Number_of_Closed_Date_Changes) + 1}
- Save and Activate
Adding to Page Layout
- Navigate to Setup > Objects > Opportunity
- Click Page Layouts tab
- Select your desired layout
- Drag the custom field onto the layout
- Click Save
Testing
- Create or edit an opportunity
- Modify the close date
- Verify the counter increments automatically