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
Sienna Luard 3Sienna Luard 3 

I need to create a formula field that calculates the number of days since an Opportunity was moved from the Prep-Opp stage

I need to create a formula field that calculates the number of days since an Opportunity was moved from the Prep-Opp stage.  I have tried this formula.

TODAY() - ISPICKVAL(StageName, "Pre-Demo")

I get this error.

Error: Incorrect parameter type for operator '-'. Expected Number, Date, DateTime, received Boolean

Could somebody please help me?
Best Answer chosen by Sienna Luard 3
Andrew GAndrew G
Slight correction - if your custom field is DATE TIME use NOW() in your formula.  If the number of days is what you are after, then make the the field type DATE and use TODAY() in your formula.

Regards
Andrew

All Answers

Andrew GAndrew G
In Opportunity, create a DATE TIME field called "PreOppStageDateChange" or whatever name appeals to you.

Go to process builder, create a process for Opportunity, on record change, if "StageName" is changed and "StageName" equals "Pre-Demo", then Immediate Action, update record, stamp "PreOppStageDateChange" with time now.

In your formula field, TODAY() - PreOppStageDateChange


HTH

AndrewG
Andrew GAndrew G
Slight correction - if your custom field is DATE TIME use NOW() in your formula.  If the number of days is what you are after, then make the the field type DATE and use TODAY() in your formula.

Regards
Andrew
This was selected as the best answer
Sienna Luard 3Sienna Luard 3
Thanks so much Andrew!
Sienna Luard 3Sienna Luard 3
Thanks so much Andrew!