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
kimstites1.389118431736615E12kimstites1.389118431736615E12 

workflow to set a date to the 1st day of the next month after an opportunity closes

I am trying to create a field that sets a date to the 1st of the next month after an opportunity is marked close won.  I am not sure how to create that formula.  
Best Answer chosen by kimstites1.389118431736615E12
Anil KamisettyAnil Kamisetty
Here is the formula to help you. You can use this in a workflow to set the date automatically (Update Field Value action on an Opportunity when the Sales Stage changes to Closed/Won).

DATE(YEAR(CloseDate),(MONTH(CloseDate)+1), DAY(Date(2001,1,1))) << Use 2001 as the year, for that matter it can be any valid year

Note : If It answers your question, please mark this as the Answer. This will help anyone who is having similar problem.

All Answers

Anil KamisettyAnil Kamisetty
Here is the formula to help you. You can use this in a workflow to set the date automatically (Update Field Value action on an Opportunity when the Sales Stage changes to Closed/Won).

DATE(YEAR(CloseDate),(MONTH(CloseDate)+1), DAY(Date(2001,1,1))) << Use 2001 as the year, for that matter it can be any valid year

Note : If It answers your question, please mark this as the Answer. This will help anyone who is having similar problem.
This was selected as the best answer
Venkat PolisettiVenkat Polisetti
Well, the above formula works for all months except December: MONTH(CloseDate) + 1 would error out if it is December and there is no 13th month unless we replace Gregorian Calendar with some thing else!

Another thing I noticed is DAY(DATE(2001,1,1) in the formula above. It could have been simply 1, right. It would unnecessarily increase the size of the formula and its compiled size.

Here is one way to do it. I have tested it with various dates and found it to be working (please post here is you see some thing that I missed).

Obviously, you need to put the below formula in the field update of your WFR.

DATE
(
IF(MONTH(CloseDate) = 12, YEAR(CloseDate) + 1, YEAR(CloseDate)),
IF(MONTH(CloseDate) = 12, 1, MONTH(CloseDate) + 1),
1
)

Thanks,
Venkat Polisetti