Close Date Change Counter
Last updated
Last updated
This document describes the steps required to create a custom field in Salesforce to track the number of times the closed date of an opportunity has been changed. Additionally, it outlines the creation of a record-triggered flow to automatically update the custom field when the closed date is modified.
Salesforce Administrator permissions
Access to the Opportunity object
Navigate to the Setup menu and select Objects > Opportunity.
Click the Fields & Relationships tab.
Click the New button.
Select the Number data type.
Enter the following field details:
Field Label: Number of Closed Date Changes
API Name: Number_of_Closed_Date_Changes
Decimal Places: 0
Default Value: 0
Click Save.
Navigate to the Setup menu and select Process Automation > Flows.
Click the New Flow button.
Select the Record-Triggered Flow template.
Enter the following flow details:
Flow Name: Update Number of Closed Date Changes
API Name: Update_Number_of_Closed_Date_Changes
Object: Opportunity
Trigger: Record is updated
Click Create.
Drag the Formula element onto the canvas.
Configure the formula as follows:
Formula Name: Closed Date Changed
Formula Type: Boolean
Formula Expression: {!Opportunity.CloseDate} != {!Opportunity.PriorCloseDate}
Drag the Assignment element onto the canvas.
Configure the assignment as follows:
Variable Name: Number of Closed Date Changes
Value: {!IF(ISBLANK(Opportunity.Number_of_Closed_Date_Changes), 0, Opportunity.Number_of_Closed_Date_Changes) + 1}
Click Save.
Click Activate.
Navigate to the Setup menu and select Objects > Opportunity.
Click the Page Layouts tab.
Select the page layout that you want to add the custom field to.
Drag the Number of Closed Date Changes field onto the page layout.
Click Save.
Create a new opportunity or edit an existing opportunity.
Change the closed date of the opportunity.
Verify that the Number of Closed Date Changes field is incremented.
By following these steps, you can easily create a custom field to track the number of times the closed date of an opportunity has been changed. This information can be useful for reporting and analysis purposes.