It's probably been asked before, but how do you duplicate the Stage Duration functionality in Opportunities on a custom field? I have a custom picklist field named "Operations Status" that serves the same purpose as the Opportunity Stage field. Users select a value that changes based on events driving our operations process. The statuses do not move in a linear fashion and can go back-and-forth based on certain events so a record can go from Value1 to Value2 to Value3 and back to Value2.

The idea is to track the duration on each status value and account for the back-and-forth situations (probably incorporating some sort of counter?) as well as the dates they occurred.

Does this involve the creation of n custom fields where n = the number of Status values or is this something that warrants it's own Custom object related to the parent object which is Opportunity in this case? Additionally, does this require the use of Apex Triggers or can this be done using declarative configuration (Workflows, Formulas, and such)?

Thank you in advance for the feedback.


  • What is your goal from duplicating the default behavior? If you want to account for the back and forth, the best thing would be a custom object that creates a new entry on every stage change.
    – CyberJus
    Commented Apr 30, 2015 at 22:30
  • As @CyberJus states, a child object makes sense - especially as SFDC derives stage duration from the Opportunity Stage related list (that is, OOB child objects). You'll most likely need triggers here
    – cropredy
    Commented May 1, 2015 at 4:37
  • The goal of duplicating the behavior is to provide our Operations team with similar functionality found when populating Opportunity Stage values. We also wanted to provide more details than what the Related History tracking list provides such as Old and New Values, an Age counter and such. I was hoping we can do this on the same Opportunity object but I had a gut feeling it will involve a related Custom object. Thank you @CyberJus and crop1645 for validating this course of action.
    – seanalee
    Commented May 1, 2015 at 13:23

1 Answer 1


Depending on your requirements, I can see two solutions here:

Solution 1

You can turn on history tracking for the Stage on the opportunity. This will track every time it has change, by who, and when. You can an opportunity history report (this is out of the box) which will give you the individual entries. Look at this help article: http://help.salesforce.com/HTViewHelpDoc?id=reports_opp_history.htm&language=en_US

Solution 2

As some of the previous comments imply - create a custom object that is a child of the Opportunity (Call it OpportunityStageEvents for arguments sake). Here is how it would work:

  1. Create the new object and the fields you want to retain (like from and to stage names, time spent in this duration, who made the change, etc.)
  2. Make the new custom object as a child of opportunity (by using master-detail relationship on the custom object to the opportunity)
  3. Next you need to trigger every time you change the stage to create a record and capture the information. There are two ways to do this: a) create an Apex trigger to get the values, create the new child object record and insert it b) use the new process builder to essentially do the same thing (my preference - and a very powerful tool - but still in beta)

Happy to provide more details if required.

  • 1
    Tammer - Solution 2 is the direction I wanted to take since it our Operations team wanted more information than what history tracking provides. I am still wrapping my head around the best time to use Lookup or M-D relationships but M-D seems appropriate for this situation. I was hoping to avoid Apex triggers so glad to hear I can use Process Builder in this case. I'll keep you and everyone else updated on my progress. Thanks.
    – seanalee
    Commented May 1, 2015 at 13:35
  • 1
    Absolutely you can use process builder - when you create a new process you get a start criteria (titled "Choose Object and Specify When to Start the Process" and it is on a per record basis). For that you want to say every time an opportunity record is edited. Next there will be a criteria you can define (check if the stage value is changed). If true then you want to add an action. Here is the magic part - create an action called "create a record". Here you will get to specify (on a per row basis) to map from the Opportunity object to your new custom object fields. Enjoy!! Commented May 1, 2015 at 14:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .