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
bmontgomeryenbalabmontgomeryenbala 

Formula for Task Duration

Hi everyone,

 

I'm looking for assistance in creating a formula that will display the duration of an opportunity task.   I want to display the number of days from when the task was created until today, still open or already closed.

 

Any help would be appreciated.

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

You could also use the slightly more effecient:

 

If(IsClosed,LastModifiedDate,NOW())-CreatedDate

 But that still lends itself to the question... What happens if the task is modified after closing?

All Answers

Jake GmerekJake Gmerek

NOW() - CreatedDate

 

That is the formula.  Remember that the type of formula should be a number even though you are dealing with a date.

 

Let me know it there are any problems with that.

Steve :-/Steve :-/

You might want to use something like this 

IF(IsClosed, LastModifiedDate - CreatedDate, NOW() - CreatedDate)

 

 

Which edition of SFDC are you on?

sfdcfoxsfdcfox

You could also use the slightly more effecient:

 

If(IsClosed,LastModifiedDate,NOW())-CreatedDate

 But that still lends itself to the question... What happens if the task is modified after closing?

This was selected as the best answer