You need to sign in to do that
Don't have an account?
Calculate the End Date from the Start Date
Does anyone have an S-Control or Formula that will take a start date and add a duration in months to calculate an end date?
I've tried handling this in SF itself through a workflow rule trigger by breaking out the dates into MM DD Year fields and manipulating that way. The problem is of course Validating the end date is a true since the current work around causes a problem. ie: Jan 31 2007 + 1 Month = Feb 31, 2007 ... not a valid date.
Since we have Admin Support SF personnel tried to write a formula for the calculation and after a few weeks gave up and told me the only way to handle this is with a Custom S-Control.
Any suggestions / help would be appreciated.
Thanks
AGM
Without getting into too much detail what you are trying to do is possible but it will require manipulating that date object and formatting it so that you can insert your end date back into the Salesforce record. The primary issue is that the date object in JavaScript is in a "Tue Dec 18 15:36:40 MST 2007" format and you'll need it in a "2007-12-18" format in order to insert into Salesforce.
Thanks for the suggestion Greg, I'll do some experimenting.
In the meantime I've worked out a solution that uses a series of custom fields / formulas and workflow field updates that works like a charm when the duration is "Months" ... if anyone is in need of this functionality I would be happy top post a the work around or e-mail me.
Regards,
Andrew
I would take your start date and use Javascript methods to extract the day, month, year from it. Then you can write a little piece of code that increments the month. Then create a new date in Javascript using the updated day, month, year. You would have to check it first yourself with a if/then or switch statement to make sure you don't create Feb 30th. I think if you pass Feb 30th to Javascript date it'll just roll it over to become Mar 2, but I'm not sure.
Here's a good source for Javascript methods:
http://www.devguru.com/Technologies/ecmascript/quickref/date.html
Thanks
David
Hi Andrew
Could you post your formula.
I have two custom fields
Contract Start Date (Updated by workflow when opportunity changed to contract status)
Term (Picklist)
I need to calculate the Contract end date from the start date by using the term. The term is in months.
So for example
Contract Start Date - 28/06/2010
Term 24
Contract End Date should be - 27/06/2012
Thanks
Geri
Hi Andrew ,
How r u?? hope u must b doing great @ ur end.
I am in a problem.Not getting any solution to find out the End date in a Installment calculation. I need to put Start Date and Terms (In months) and through javascript Automatic the End Date Calculation will be done and printed in text box.
Thank you very much in advance.
I really barely needed it soon.Some urgency there.
Thank You,
Nijan (rtrath@gmail.com)
Hi
Not sure if this is of any help but I use a formula to calculate my contract end date, determined by start date and term in months
Contract_Start_Date__c + (365 * VALUE(Text( Term_Committed__c )) / 12)
Geri
Really Thankful to you,
But not getting how to implement into javascript and to show in the text box to continue posting my form with other details.
Please elaborate.
Tnx again,
Nijan
Hey Geri,
Your formula was helpful indeed, it works! thank you, it saved me time and effort.