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
ArtWArtW 

Stage Duration: Creating A Formula That Counts Days @ Each Stage

I have a custom object where I am attempting to count and "Lock In" the number of days that a record sits at each of the 5 or 6 Stages in our process.  I used this formula, but it's not producing the results I need: 

Today() - Job_Status_Change__c

 

Here is an example of what my formula is producing for a Job that has on it's 50th day:

 

Stage 1 50

Stage 2 50

Stage 3 50

Stage 4 50

Stage 5 50

 

Here is what that very same project Stage Duration will reflect should I create the correct formula:

 

Stage 1 5

Stage 2 9

Stage 3 4

Stage 4 12

Stage 5 19

 

* the aggregate days for this Job is still 50 days, but the formula has captured the total number of days this Job sat at each of our Stages. 

 

Any suggestions?

 

Thanks in advance for you help. 

 

 

Steve :-/Steve :-/

Which edition of SFDC are you on?  If you're on EE or UE you can do this with a Workflow Rule and a Field Update.

ArtWArtW

I'm on enterprise

Steve :-/Steve :-/

As Sgt. Horvath said in Saving Private Ryan "We're in business boys!!!"

Here's what you need to do -> http://sites.force.com/answers/apex/ideaview?id=08730000000HJVLAA4

ArtWArtW

Steve, I couldn't get this work. So instead wrote a trigger to support this effort. Is there a way that we can make this effectie retroactively? If so, and it's the data loader, please help ... not a data loader expert:

 

trigger UpdateEstimateStageUpdateDate on SFDC_Estimate__c (before update) {

  integer i=0; for(SFDC_Estimate__c p : Trigger.new){if(Trigger.old[i].SFDC_Sales_Status__c != Trigger.new[i].SFDC_Sales_Status__c){

      if (Trigger.old[i].SFDC_Sales_Status__c == 'Waiting On CSS' && Trigger.new[i].SFDC_Sales_Status__c == 'Waiting on Engineering Permit') {

        Trigger.new[i].Duration_Waiting_On_CSS__c = Trigger.new[i].Stage_Duration__c;

 

 

******** STEVE I REPEATED THIS FOR EACH OF OUR * STEPS, then here was my last line*********

 

      Trigger.new[i].Stage_Change_Date__c = system.Today();

      }

    i+=1;

    }

}

Steve :-/Steve :-/

Hi Art,

 

If you follow the last step in my instructions (the link my earlier post) you might be able to get some level of "retroactive" Stage Duration data.

 

 

Steve :-/Steve :-/

Are you all set or do you need help with anything?

petec@i2isyspetec@i2isys

Steve, I have a similar issue but the link you posted is broken.

Basically, I need to be able to create a custom field in an opportunity called Stage Duratation that would calculate the amount of days an opportunity is in a particular stage.  Stage duration seems to be a field you can get to in reports, but I don't see it anywhere in the opportunity fields.

 

Once that was done I would want to be able to create a workflow rule that would trigger if the number of days in a stage exceeded our best practices.

 

Any suggestions?

Thanks,
Pete

petec@i2isyspetec@i2isys

Hi Steve, the links you sent work, but address reporting.  I'm able to run reports on stage duration just fine.

 

What I am trying to do is create a workflow rule in order to ping salespeople who are in a stage longer than what we want.  I can't find anything on how to do that.

 

I'm thinking I would need to create a custom field in an Opportunity that calculates the time in a stage.  Then, once that was done I would want to be able to create a workflow rule that would trigger if the number of days in a stage exceeded our best practices.  This is also information I'm looking for.

 

Any help would be greatly appreciated.

Thanks,
Pete

Liubov Korneva 5Liubov Korneva 5
Steve, 
any chance you can share the link again, this one  http://sites.force.com/answers/apex/ideaview?id=08730000000HJVLAA4 doesn't work. Thank you
Francisco López FigueroaFrancisco López Figueroa

Hi, escentially you can create one specific date field for each stage and another number field for count and use a formula similiar to this one:

now () - 
if(value(text(Status)) = 1, Date_Satge 1, 
if(value(text(Status)) = 2, Date_Stage2, 
if(value(text(Status)) = 3, Date_Stage3,
if(value(text(Status)) = 4, Date_Stage4,
if(value(text(Status)) = 5, Date_Stage5,
if(value(text(Status)) = 6,  Date_Stage6,
if(value(text(Status)) = 7, Date_Stage7,
if(value(text(Status)) = 8, Date_Stage8,
if(value(text(Status)) = 9, Date_Stage9, Date_Stage10)))))))))