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
RyanYoung429RyanYoung429 

Custom Button: Setting Date in custom field to first of the next month OR last of next month

Hello!
I have A custom button that will allow the creation of a "child" opportunity. I have all my valuse set/cleared except I would like to Set the Start Date field to the first date of the next month and the End Date to the last day of the next month.

Does anyone have the syntax I can use after the field id to do that?
Sumeet_ForceSumeet_Force
Hi Ryan,
You can use below for start date:
DATE(YEAR(TODAY()), MONTH(TODAY())+1,1)

Similarly, you can perform some more conditions check to identify the last date of next month.

 
RyanYoung429RyanYoung429
Hi Sumeet! Thanks for your reply!

I put the two date fields in the custom button linke this:
00N25000000gHo7='DATE(YEAR(TODAY()), MONTH(TODAY())+1,1)'
00N25000000gHoC='DATE(YEAR(TODAY()), MONTH(TODAY())+1,1)'

and like this:
00N25000000gHo7=DATE(YEAR(TODAY()), MONTH(TODAY())+1,1)
00N25000000gHoC=DATE(YEAR(TODAY()), MONTH(TODAY())+1,1)

And it's not working. It is putting the actual text of the formula into the first date field and the secod is putting the date out to April instead of March.
RyanYoung429RyanYoung429
Here is the full text:

/{!Opportunity.Id}/e?clone=1&retURL=/{!Opportunity.Id}&cloneli=0&
RecordType=012250000000NEN&ent=Opportunity&
00N25000000gt3d&
CF00N25000000h2NN={!Opportunity.Name}&
CF00ND0000005vIHD&
CF00ND0000005vIHD&
00ND0000006DoSe&
00ND0000006Dogy&
00ND0000005vIHC=False&
00ND0000005ohwp&
00ND0000005vFPW&
00N25000000gHo7=DATE(YEAR(TODAY()), MONTH(TODAY())+1,1)
00N25000000gHoC=DATE(YEAR(TODAY()), MONTH(TODAY())+1,1)
opp9={!TODAY()}&
opp7&
opp11=US:Verbal-LOI&
opp12=90