Close Date Change Counter

Create a Counter for Closed Date Changes

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.

Prerequisites

  • Salesforce Administrator permissions

  • Access to the Opportunity object

Creating the Custom Field

  1. Navigate to the Setup menu and select Objects > Opportunity.

  2. Click the Fields & Relationships tab.

  3. Click the New button.

  4. Select the Number data type.

  5. 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

  6. Click Save.

Creating the Record-Triggered Flow

  1. Navigate to the Setup menu and select Process Automation > Flows.

  2. Click the New Flow button.

  3. Select the Record-Triggered Flow template.

  4. 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

  5. Click Create.

  6. Drag the Formula element onto the canvas.

  7. Configure the formula as follows:

    • Formula Name: Closed Date Changed

    • Formula Type: Boolean

    • Formula Expression: {!Opportunity.CloseDate} != {!Opportunity.PriorCloseDate}

  8. Drag the Assignment element onto the canvas.

  9. 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}

  10. Click Save.

  11. Click Activate.

Adding the Custom Field to the Page Layout

  1. Navigate to the Setup menu and select Objects > Opportunity.

  2. Click the Page Layouts tab.

  3. Select the page layout that you want to add the custom field to.

  4. Drag the Number of Closed Date Changes field onto the page layout.

  5. Click Save.

Testing the Flow

  1. Create a new opportunity or edit an existing opportunity.

  2. Change the closed date of the opportunity.

  3. Verify that the Number of Closed Date Changes field is incremented.

Conclusion

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.

Last updated

Was this helpful?