function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Eric FortenberryEric Fortenberry 

Can the Opportunity Close Date field be automatically updated based on the Stage?

When creating a new opportunities, I would like to automatically update the Close Date field based on the Stage field.  Ideally, it would work the same way the Probability (%) field is automatically updated when the Stage is selected?  The close date should be set to Today () + the number of days as defined below for each stage:  


Stage 1 - 360 days

Stage 2 - 180 days

Stage 3 - 90 days

Stage 4 - 30 days


Thanks for the help!


To modify this functionality on the page, you'd have to replace the standard New Opportunity page with a custom visualforce page.

Eric FortenberryEric Fortenberry

What about just adding a new custom field called Close Date and having that field automatically updated based on the Stage field?  Isn't there some sort of way to do that with field validation?




Better you can create a custom formula field which capture the Close Date + Days for Stage and make this field visible on page layout in place of standard Close Date field

Eric FortenberryEric Fortenberry
Could you provide a rough outline of what the formula would look like? It'd need to check the stage and based on which stage assign the number of days to add to today's date.

Hi Eric,


For this I have created two fields:

1. State_New__c (PickList): I have givend values as 1,2,3,4 (You can give any values you want)

2. Cls_Date__c (Formula field):


CloseDate + (IF( ISPICKVAL( Stage_New__c , "1") , 360,  IF( ISPICKVAL( Stage_New__c , "2") , 180,  IF( ISPICKVAL( Stage_New__c , "3") , 90, IF( ISPICKVAL( Stage_New__c , "4") , 30,0) ))))

 Here I have added the number of days to the standar 'CloseDate' field.

If you are want to use the standard Stage field or if you want to add days from Today() in stead of 'CloseDate', update the formula value accordingly.