The best solution for your requirment would be to have n fields (in case if you have n stages) for capturing the time for which the opportunity was in each stage.
You could use a trigger to capture the time interval whenever there is a change of stage in the opportunity in the appropriate field meant for this purpose.
Also you can refer to the following code for finding the interval / time period between 2 dates:-
date startDate = date.newInstance(2008, 1, 1); date dueDate = date.newInstance(2008, 1, 30); integer numberDaysDue = startDate.daysBetween(dueDate);
Hope this helps ? If not, let me know what didn't work, or if so, please mark it solved.
No trigger is really necessary. Just setup one Date/Time field for each stage, then setup 1 field update per D/T field you created. Have it figure (and re-fire) each time the stage is set from one to the other. Now just do a formula comparing the times between the current stage and the created date. Or setup a calculation of time between each stage?
Hi Avi123,
The best solution for your requirment would be to have n fields (in case if you have n stages) for capturing the time for which the opportunity was in each stage.
You could use a trigger to capture the time interval whenever there is a change of stage in the opportunity in the appropriate field meant for this purpose.
Also you can refer to the following code for finding the interval / time period between 2 dates:-
date startDate = date.newInstance(2008, 1, 1);
date dueDate = date.newInstance(2008, 1, 30);
integer numberDaysDue = startDate.daysBetween(dueDate);
Hope this helps ? If not, let me know what didn't work, or if so, please mark it solved.
No trigger is really necessary. Just setup one Date/Time field for each stage, then setup 1 field update per D/T field you created. Have it figure (and re-fire) each time the stage is set from one to the other. Now just do a formula comparing the times between the current stage and the created date. Or setup a calculation of time between each stage?